[issue38070] visit_decref(): add an assertion to check that the object is not freed

STINNER Victor report at bugs.python.org
Mon Sep 9 10:12:09 EDT 2019


STINNER Victor <vstinner at python.org> added the comment:

> visit_decref() is commonly found in C traceback (ex: gdb backtrace) of bugs related to the garbage collector.

Example with attached bpo-38037-bug.patch: you can apply this patch on the master branch to reintroduce  bpo-38037 bug.

vstinner at apu$ git apply bpo-38037-bug.patch
vstinner at apu$ make

Without PR 15782:

vstinner at apu$ ./python -c pass 
Segmentation fault (core dumped)


With PR 15782:

vstinner at apu$ ./python -c pass 
Modules/gcmodule.c:379: visit_decref: Assertion "!_PyObject_IsFreed(op)" failed
<object: freed>
Fatal Python error: _PyObject_AssertFailed

Current thread 0x00007f171a280740 (most recent call first):
Aborted (core dumped)


The bug is catched earlier. And Python provides more information.

----------
Added file: https://bugs.python.org/file48602/bpo-38037-bug.patch

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38070>
_______________________________________


More information about the Python-bugs-list mailing list