gh-109496: Detect Py_DECREF() after dealloc in debug mode (#109539)
On a Python built in debug mode, Py_DECREF() now calls _Py_NegativeRefcount() if the object is a dangling pointer to deallocated memory: memory filled with 0xDD "dead byte" by the debug hook on memory allocators. The fix is to check the reference count *before* checking for _Py_IsImmortal(). Add test_decref_freed_object() to test_capi.test_misc.
V
Victor Stinner committed
0bb0d88e2d4e300946e399e088e2ff60de2ccf8c
Parent: ef659b9
Committed by GitHub <noreply@github.com>
on 9/18/2023, 2:59:09 PM