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
.azure-pipelines
.github
Doc
Grammar
Include
Lib
Mac
Misc
Modules
Objects
PC
PCbuild
Parser
Programs
Python
Tools
m4
.gitattributes -rw-r--r-- 1.5 KB
.gitignore -rw-r--r-- 1.6 KB
.travis.yml -rw-r--r-- 7.6 KB
CODE_OF_CONDUCT.md -rw-r--r-- 609 bytes
LICENSE -rw-r--r-- 12.5 KB
Makefile.pre.in -rw-r--r-- 61.0 KB
README.rst -rw-r--r-- 10.0 KB
aclocal.m4 -rw-r--r-- 10.7 KB
config.guess -rwxr-xr-x 43.1 KB
config.sub -rwxr-xr-x 35.4 KB
configure -rwxr-xr-x 481.9 KB
configure.ac -rw-r--r-- 157.8 KB
install-sh -rw-r--r-- 15.0 KB
pyconfig.h.in -rw-r--r-- 42.6 KB
setup.py -rw-r--r-- 98.8 KB

README.rst

back to top