https://github.com/python/cpython
Revision 626bff856840f471e98ec627043f780c111a063d authored by Victor Stinner on 25 October 2018, 15:31:10 UTC, committed by GitHub on 25 October 2018, 15:31:10 UTC
Changes:

* Add _PyObject_AssertFailed() function.
* Add _PyObject_ASSERT() and _PyObject_ASSERT_WITH_MSG() macros.
* gc_decref(): replace assert() with _PyObject_ASSERT_WITH_MSG() to
  dump the faulty object if the assertion fails.

_PyObject_AssertFailed() calls:

* _PyMem_DumpTraceback(): try to log the traceback where the object
  memory has been allocated if tracemalloc is enabled.
* _PyObject_Dump(): log repr(obj).
* Py_FatalError(): log the current Python traceback.

_PyObject_AssertFailed() uses _PyObject_IsFreed() heuristic to check
if the object memory has been freed by a debug hook on Python memory
allocators.

Initial patch written by David Malcolm.

Co-Authored-By: David Malcolm <dmalcolm@redhat.com>
1 parent 18618e6
History
Tip revision: 626bff856840f471e98ec627043f780c111a063d authored by Victor Stinner on 25 October 2018, 15:31:10 UTC
bpo-9263: Dump Python object on GC assertion failure (GH-10062)
Tip revision: 626bff8
File Mode Size
Python.asdl -rw-r--r-- 4.7 KB
acceler.c -rw-r--r-- 3.3 KB
asdl.py -rw-r--r-- 12.6 KB
asdl_c.py -rw-r--r-- 42.3 KB
bitset.c -rw-r--r-- 1.0 KB
firstsets.c -rw-r--r-- 2.8 KB
grammar.c -rw-r--r-- 7.4 KB
grammar1.c -rw-r--r-- 1.3 KB
listnode.c -rw-r--r-- 1.3 KB
metagrammar.c -rw-r--r-- 2.4 KB
myreadline.c -rw-r--r-- 9.9 KB
node.c -rw-r--r-- 4.4 KB
parser.c -rw-r--r-- 11.6 KB
parser.h -rw-r--r-- 1.2 KB
parsetok.c -rw-r--r-- 10.7 KB
parsetok_pgen.c -rw-r--r-- 35 bytes
pgen.c -rw-r--r-- 17.9 KB
pgenmain.c -rw-r--r-- 4.1 KB
printgrammar.c -rw-r--r-- 2.9 KB
tokenizer.c -rw-r--r-- 53.0 KB
tokenizer.h -rw-r--r-- 3.1 KB
tokenizer_pgen.c -rw-r--r-- 36 bytes

back to top