Skip to content

fix(sdk-python): keep the end of truncated tracebacks - #89

Merged
aikins01 merged 1 commit into
mainfrom
fix/sdk-python-traceback-truncation
Oct 27, 2026
Merged

aikins01 merged 1 commit into
mainfrom
fix/sdk-python-traceback-truncation

Conversation

@aikins01

Copy link
Copy Markdown
Contributor

A Python traceback prints the innermost frame and the Type: message line last. When exception.stacktrace was longer than max_attribute_length, the Python core kept its start and cut exactly those lines. It now keeps the end of the stack trace and puts the ...[truncated] marker first.

Only exception.stacktrace changes. truncate, serialize_content, and Client.serialize take a keyword-only keep_end that defaults to off, so other attributes and existing callers keep their start. The TypeScript core is unchanged because V8 stacks start with the message line, which a head cut already keeps. A tail cut that lands inside a surrogate pair drops the lone half, as the head cut already does.

The docs say "normally" on purpose: an exception line longer than the limit, add_note() notes, and ExceptionGroup can still put the exception line outside the kept part.

A Python traceback prints the innermost frame and the exception line
last, so truncating exception.stacktrace to max_attribute_length by
keeping its start dropped the most useful part. The stack trace now
keeps its end, with the truncation marker first. Other attributes and
the TypeScript core, whose stacks start with the message line, still
keep their start.
@aikins01 aikins01 self-assigned this Oct 27, 2026
@aikins01
aikins01 merged commit 2404ae4 into main Oct 27, 2026
10 checks passed
@aikins01
aikins01 deleted the fix/sdk-python-traceback-truncation branch October 27, 2026 11:38
@aikins01 aikins01 mentioned this pull request Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant