Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-128799: Add frame of except* to traceback when wrapping a naked exception #128971

Merged
merged 7 commits into from
Jan 25, 2025

Conversation

iritkatriel
Copy link
Member

@iritkatriel iritkatriel commented Jan 18, 2025

Fixes #128799.

>>> def f():
...     try:
...         raise Exception  # Exception (inner) traceback terminates here
...     except* Exception as e:
...         raise
... 
... f()  # ExceptionGroup (wrapper) traceback terminates here
... 
  + Exception Group Traceback (most recent call last):
  |   File "<python-input-0>", line 7, in <module>
  |     f()  # ExceptionGroup (wrapper) traceback terminates here
  |     ~^^
  |   File "<python-input-0>", line 4, in f
  |     except* Exception as e:
  |         raise
  | ExceptionGroup:  (1 sub-exception)
  +-+---------------- 1 ----------------
    | Traceback (most recent call last):
    |   File "<python-input-0>", line 3, in f
    |     raise Exception  # Exception (inner) traceback terminates here
    |     ^^^^^^^^^^^^^^^
    | Exception
    +------------------------------------
>>> 

Copy link
Member

@gvanrossum gvanrossum left a comment

Choose a reason for hiding this comment

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

This looks right.

@iritkatriel iritkatriel added needs backport to 3.12 bug and security fixes needs backport to 3.13 bugs and security fixes labels Jan 25, 2025
@iritkatriel iritkatriel enabled auto-merge (squash) January 25, 2025 12:43
@iritkatriel iritkatriel merged commit c39ae89 into python:main Jan 25, 2025
61 checks passed
@miss-islington-app
Copy link

Thanks @iritkatriel for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13.
🐍🍒⛏🤖

@miss-islington-app
Copy link

Sorry, @iritkatriel, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker c39ae8922bad3e5ceeafa05891536c1584b6f3db 3.13

@miss-islington-app
Copy link

Sorry, @iritkatriel, I could not cleanly backport this to 3.12 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker c39ae8922bad3e5ceeafa05891536c1584b6f3db 3.12

iritkatriel added a commit to iritkatriel/cpython that referenced this pull request Jan 25, 2025
iritkatriel added a commit to iritkatriel/cpython that referenced this pull request Jan 25, 2025
@bedevere-app
Copy link

bedevere-app bot commented Jan 25, 2025

GH-129299 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Jan 25, 2025
iritkatriel added a commit to iritkatriel/cpython that referenced this pull request Jan 27, 2025
…ng a naked exception (pythonGH-128971)

(cherry picked from commit c39ae89)

Co-authored-by: Irit Katriel <[email protected]>
@bedevere-app
Copy link

bedevere-app bot commented Jan 27, 2025

GH-129328 is a backport of this pull request to the 3.12 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.12 bug and security fixes label Jan 27, 2025
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.

Unexpected location of naked exception wrapped in except* block
2 participants