]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.11] gh-111777: Fix assertion errors on incorrectly still-tracked GC object destruc...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 17 Jan 2024 14:10:12 +0000 (15:10 +0100)
committerGitHub <noreply@github.com>
Wed, 17 Jan 2024 14:10:12 +0000 (15:10 +0100)
commit67424458d23428d524e7c08e1556d7687297dbaa
tree3b376c681bc8a9fb6c0541128dca426f218873f5
parent99a7bdc646f1a7020231156e4aca19b949d8ee71
[3.11] gh-111777: Fix assertion errors on incorrectly still-tracked GC object destruction (GH-111778) (GH-111990)

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.
(cherry picked from commit ce6a533c4bf1afa3775dfcaee5fc7d5c15a4af8c)

Co-authored-by: T. Wouters <thomas@python.org>
Modules/gcmodule.c