Skip to content

[3.13] gh-122478: Remove internal frames from tracebacks in REPL (GH-122528) - #122817

Closed
miss-islington wants to merge 1 commit into
python:3.13from
miss-islington:backport-e73e7a7-3.13
Closed

[3.13] gh-122478: Remove internal frames from tracebacks in REPL (GH-122528)#122817
miss-islington wants to merge 1 commit into
python:3.13from
miss-islington:backport-e73e7a7-3.13

Conversation

@miss-islington

@miss-islingtonmiss-islington commented Aug 8, 2024

Copy link
Copy Markdown
Contributor

Frames of methods in code and codeop modules was show with non-default
sys.excepthook.

Save correct tracebacks in sys.last_traceback and update traceback
attribute of sys.last_value and sys.last_exc.
(cherry picked from commit e73e7a7)

Co-authored-by: Serhiy Storchaka storchaka@gmail.com

…onGH-122528)
Frames of methods in code and codeop modules was show with non-default
sys.excepthook.
Save correct tracebacks in sys.last_traceback and update __traceback__
attribute of sys.last_value and sys.last_exc.
(cherry picked from commit e73e7a7)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Comment threadLib/code.py
# over self.write
self._call_excepthook(type, value, tb)
try:
typ, value, tb = sys.exc_info()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These days we do exc = sys.exception() and then use exc.__traceback__ and type(exc).

@cfbolzcfbolz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@cfbolz

cfbolz commented Aug 23, 2024

Copy link
Copy Markdown
Contributor

backport happened in #123227

@cfbolzcfbolz closed this Aug 23, 2024
@miss-islington
miss-islington deleted the backport-e73e7a7-3.13 branch January 2, 2026 18:53
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@miss-islington@cfbolz@iritkatriel@serhiy-storchaka