Skip to content

gh-156459: Fix cleanup on error in compiler_set_qualname - #156462

Merged
iritkatriel merged 7 commits into
python:mainfrom
iritkatriel:gh-156459
Aug 29, 2026
Merged

gh-156459: Fix cleanup on error in compiler_set_qualname#156462
iritkatriel merged 7 commits into
python:mainfrom
iritkatriel:gh-156459

Conversation

@iritkatriel

@iritkatriel iritkatriel commented Aug 27, 2026

Copy link
Copy Markdown
Member

Move the operation to _PyCompile_SetQualname and call it after _PyCompile_EnterScope returns (with cleanup if it fails).

Resolves #156459.

This was discovered through code inspection, not via a runtime bug. There is no reliable way to write a test for this as failures would be memory errors and the like.

@iritkatriel iritkatriel added 3.13 bugs and security fixes 3.14 bugs and security fixes 3.15 pre-release feature fixes, bugs and security fixes 3.16 new features, bugs and security fixes labels Aug 27, 2026
Comment thread Misc/NEWS.d/next/Core_and_Builtins/2026-08-27-13-26-50.gh-issue-156459.Z8Zqik.rst Outdated
@iritkatriel iritkatriel added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes and removed 3.13 bugs and security fixes 3.14 bugs and security fixes 3.15 pre-release feature fixes, bugs and security fixes 3.16 new features, bugs and security fixes labels Aug 29, 2026
@iritkatriel
iritkatriel enabled auto-merge (squash) August 29, 2026 11:50
@iritkatriel
iritkatriel merged commit 8b082aa into python:main Aug 29, 2026
54 checks passed
@miss-islington-app

Copy link
Copy Markdown

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

@bedevere-app

bedevere-app Bot commented Aug 29, 2026

Copy link
Copy Markdown

GH-156574 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label Aug 29, 2026
@miss-islington-app

Copy link
Copy Markdown

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 8b082aa405101ab806433cd4d7305b19397271cf 3.13

@bedevere-app

bedevere-app Bot commented Aug 29, 2026

Copy link
Copy Markdown

GH-156575 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Aug 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs backport to 3.13 bugs and security fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect error handling when compiler_set_qualname fails

3 participants