gh-105658: fix excess trace events for except block ending with a conditional block#109384
gh-105658: fix excess trace events for except block ending with a conditional block#109384iritkatriel merged 4 commits intopython:mainfrom
Conversation
carljm
left a comment
There was a problem hiding this comment.
I don't see a test here that reflects the case in the filed bug, where the line number actually jumps back to a previous line in a conditional. I believe that this change would fix that, but would it make sense to add an explicit test for it?
Misc/NEWS.d/next/Core and Builtins/2023-09-13-19-16-51.gh-issue-105658.z2nR2u.rst
Outdated
Show resolved
Hide resolved
| (3, 'line'), | ||
| (3, 'exception'), | ||
| (5, 'line'), | ||
| (6, 'line'), |
There was a problem hiding this comment.
On main we have here another
(5, 'line'),
|
Thanks @iritkatriel for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12. |
|
Sorry, @iritkatriel, I could not cleanly backport this to |
|
|
… a conditional block (python#109384) (cherry picked from commit 4a54074)
|
|
|
GH-109411 is a backport of this pull request to the 3.12 branch. |
|
This will remove the event with the wrong line number. It will still work because RERAISE doesn't need to have a line number attached. In exception_unwind, the instruction pointer on the frame is used to determine which exception handler should be invoked. The location of the reraise doesn't show up in the traceback.
Fixes #105658.