Skip to content

[3.13] gh-130851: Only intern constants of types generated by the compiler (GH-130901) #130953

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

Merged
merged 1 commit into from
Mar 8, 2025

Conversation

colesbury
Copy link
Contributor

@colesbury colesbury commented Mar 7, 2025

The free-threading build interns and immortalizes most constants generated by the bytecode compiler. However, users can construct their own code objects with arbitrary constants. We should not intern or immortalize these objects if they are not of a type that we know how to handle.

This change fixes a reference leak failure in the recently added test_code.test_unusual_constants test. It also addresses a potential crash that could occur when attempting to destroy an immortalized object during interpreter shutdown.
(cherry picked from commit 12db452)

…he compiler (pythonGH-130901)

The free-threading build interns and immortalizes most constants
generated by the bytecode compiler. However, users can construct their
own code objects with arbitrary constants. We should not intern or
immortalize these objects if they are not of a type that we know how to
handle.

This change fixes a reference leak failure in the recently added
`test_code.test_unusual_constants` test. It also addresses a potential
crash that could occur when attempting to destroy an immortalized
object during interpreter shutdown.
(cherry picked from commit 12db452)

Co-authored-by: Sam Gross <[email protected]>
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @colesbury for commit 2d72e4d 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F130953%2Fmerge

If you want to schedule another build, you need to add the 🔨 test-with-refleak-buildbots label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-refleak-buildbots Test PR w/ refleak buildbots; report in status section label Mar 7, 2025
@colesbury colesbury marked this pull request as ready for review March 7, 2025 21:57
@colesbury colesbury requested a review from markshannon as a code owner March 7, 2025 21:57
@colesbury colesbury merged commit 14230cd into python:3.13 Mar 8, 2025
51 of 52 checks passed
@colesbury colesbury deleted the backport-12db452-3.13 branch March 8, 2025 18:07
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