mirror of
https://github.com/python/cpython.git
synced 2026-01-04 14:32:21 +00:00
bpo-38070: visit_decref() calls _PyObject_IsFreed() (GH-15782)
In debug mode, visit_decref() now calls _PyObject_IsFreed() to ensure
that the object is not freed. If it's freed, the program fails with
an assertion error and Python dumps informations about the freed
object.
(cherry picked from commit d91d4de317)
Co-authored-by: Victor Stinner <vstinner@redhat.com>
This commit is contained in:
parent
2d5594fac2
commit
5731172bb1
1 changed files with 2 additions and 0 deletions
|
|
@ -376,6 +376,8 @@ static int
|
|||
visit_decref(PyObject *op, void *data)
|
||||
{
|
||||
assert(op != NULL);
|
||||
_PyObject_ASSERT(op, !_PyObject_IsFreed(op));
|
||||
|
||||
if (PyObject_IS_GC(op)) {
|
||||
PyGC_Head *gc = AS_GC(op);
|
||||
/* We're only interested in gc_refs for objects in the
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue