Skip to content

gh-156466: fix cleanup on error in codegen_leave_annotations_scope - #156497

Merged
iritkatriel merged 2 commits into
python:mainfrom
iritkatriel:gh-156466-3
Aug 28, 2026
Merged

gh-156466: fix cleanup on error in codegen_leave_annotations_scope#156497
iritkatriel merged 2 commits into
python:mainfrom
iritkatriel:gh-156466-3

Conversation

@iritkatriel

@iritkatriel iritkatriel commented Aug 27, 2026

Copy link
Copy Markdown
Member

codegen_leave_annotations_scope could return on an error before the call to _PyCompile_ExitScope, and then the scope would not exit. Moved the _PyCompile_ExitScope up.

Also renamed the function because otherwise a return value of False should mean "I did not exit the scope". Now the name is not about leaving the scope (we always leave the scope).

@iritkatriel iritkatriel added needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes labels Aug 27, 2026
@iritkatriel
iritkatriel merged commit 8e0159b into python:main Aug 28, 2026
55 checks passed
@miss-islington-app

Copy link
Copy Markdown

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

@miss-islington-app

Copy link
Copy Markdown

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

cherry_picker 8e0159bd2338c8dff93dd443181e3402c88c70a8 3.15

@miss-islington-app

Copy link
Copy Markdown

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

cherry_picker 8e0159bd2338c8dff93dd443181e3402c88c70a8 3.14

Sign up for free to 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.

2 participants