]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.13] GH-91636: Clear weakrefs created by finalizers. (GH-136401) (GH-144214)
authorSergey Miryanov <sergey.miryanov@gmail.com>
Mon, 23 Mar 2026 23:50:41 +0000 (04:50 +0500)
committerGitHub <noreply@github.com>
Mon, 23 Mar 2026 23:50:41 +0000 (00:50 +0100)
commiteda53e6cf1c518704d870dd77c35f0cca9c71c52
treed0076eca1bc88a2424cf862afd33784fbc9db26f
parent43fe06b96f6a6cf5cfd5bdab20b8649374956866
[3.13] GH-91636: Clear weakrefs created by finalizers. (GH-136401) (GH-144214)

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