Skip to content

Respect __suppress_context__ when printing traceback - #2155

Merged
slozier merged 2 commits into
IronLanguages:mainfrom
slozier:suppress
Nov 8, 2026
Merged

slozier merged 2 commits into
IronLanguages:mainfrom
slozier:suppress

Conversation

@slozier

@slozier slozier commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Respect __suppress_context__ when printing traceback and fix some typos. The chain is now read from the Python exception instead of InnerException, which printed the wrong cause or no context when the same exception object was raised again. Also adds cycle detection.

Also fixes re-raising an exception outside an except block dropping its previous __context__ and sets the __context__ on .NET exceptions wrapping Python exceptions (e.g. an AggregateException from Task.Wait()).

Resolves #4 and resolves #5.

@slozier
slozier merged commit 57ea2ba into IronLanguages:main Nov 8, 2026
22 of 35 checks passed
@slozier
slozier deleted the suppress branch November 8, 2026 04:41
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.

PEP 415 -- Implement context suppression with exception attributes PEP 409 -- Suppressing exception context

1 participant