]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.13] gh-130851: Only intern constants of types generated by the compiler (GH-130901...
authorSam Gross <colesbury@gmail.com>
Sat, 8 Mar 2025 18:07:39 +0000 (13:07 -0500)
committerGitHub <noreply@github.com>
Sat, 8 Mar 2025 18:07:39 +0000 (13:07 -0500)
commit14230cd96cd9275e98965def7907979c0ad9f024
tree82804c1c84ae206fd27047b57b42333d82ec225a
parent597a953484c28a07fe1c81a76db0a58985959d12
[3.13] gh-130851: Only intern constants of types generated by the compiler (GH-130901) (#130953)

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 12db45211d411583cbe272c7ba6811a811b721ca)
Objects/codeobject.c