Skip to content

Conversation

@tpoliaw
Copy link
Contributor

@tpoliaw tpoliaw commented Jan 9, 2026

The built-in repl only displays the context of an exception (the "During
the handling of the above exception..." message) if suppress_context
is not set, eg by using

raise Exception() from xyz

This makes ptpython behave the same way.

See description of default behaviour in the python docs:

https://docs.python.org/3/library/exceptions.html#BaseException.__suppress_context__

The built-in repl only displays the context of an exception (the "During
the handling of the above exception..." message) if __suppress_context__
is not set, eg by using

    raise Exception() from xyz

This makes ptpython behave the same way.

See description of default behaviour in the python docs:

    https://docs.python.org/3/library/exceptions.html#BaseException.__suppress_context__
@tpoliaw
Copy link
Contributor Author

tpoliaw commented Jan 9, 2026

Example to demonstrate the behaviour

try:
    1/0
except ZeroDivisionError:
    raise ValueError("zero") from None

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