]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-111777: Fix assertion errors on incorrectly still-tracked GC object destruction...
authorT. Wouters <thomas@python.org>
Sun, 12 Nov 2023 00:03:34 +0000 (01:03 +0100)
committerGitHub <noreply@github.com>
Sun, 12 Nov 2023 00:03:34 +0000 (01:03 +0100)
commitce6a533c4bf1afa3775dfcaee5fc7d5c15a4af8c
treead689a3eee99cfb35b706ad0c604de3bcca15437
parent21615f77b5a580e83589abae618dbe7c298700e2
gh-111777: Fix assertion errors on incorrectly still-tracked GC object destruction (#111778)

In PyObject_GC_Del, in Py_DEBUG mode, when warning about GC objects that
were not properly untracked before starting destruction, take care to
untrack the object _before_ warning, to avoid triggering a GC run and
causing the problem the code tries to warn about. Also make sure to save and
restore any pending exceptions, which the warning would otherwise clobber or
trigger an assertion error on.
Modules/gcmodule.c