Commit 13ca1f0
gh-111777: Fix assertion errors on incorrectly still-tracked GC object destruction (GH-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.
(cherry picked from commit ce6a533)
Co-authored-by: T. Wouters <[email protected]>
1 parent 1afc4dc commit 13ca1f0
1 file changed
+3
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2381 | 2381 | | |
2382 | 2382 | | |
2383 | 2383 | | |
| 2384 | + | |
2384 | 2385 | | |
| 2386 | + | |
2385 | 2387 | | |
2386 | 2388 | | |
2387 | 2389 | | |
2388 | 2390 | | |
2389 | 2391 | | |
| 2392 | + | |
2390 | 2393 | | |
2391 | | - | |
2392 | 2394 | | |
2393 | 2395 | | |
2394 | 2396 | | |
| |||
0 commit comments