]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.14] GH-91636: Clear weakrefs created by finalizers. (GH-136401) (#141993)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sat, 29 Nov 2025 07:34:36 +0000 (08:34 +0100)
committerGitHub <noreply@github.com>
Sat, 29 Nov 2025 07:34:36 +0000 (23:34 -0800)
commitfed2af6f9ea7f3cece57947c988f382f3309f6cb
tree64884ed20fb0b7b75e5d7bd0bbd5e6c7a6914545
parentf7d17ac9f8b570a9900456a29b46639f02c03d16
[3.14] GH-91636: Clear weakrefs created by finalizers. (GH-136401) (#141993)

GH-91636: Clear weakrefs created by finalizers. (GH-136401)

Weakrefs to unreachable garbage that are created during running of
finalizers need to be cleared.  This avoids exposing objects that
have `tp_clear` called on them to Python-level code.
(cherry picked from commit b6b99bf7f1edab77c485faf4e23da868f3a7b68c)

Co-authored-by: Neil Schemenauer <nas-github@arctrix.com>
Lib/test/test_gc.py
Misc/NEWS.d/next/Core_and_Builtins/2025-07-07-17-26-06.gh-issue-91636.GyHU72.rst [new file with mode: 0644]
Python/gc.c
Python/gc_free_threading.c