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
ci.yml -rw-r--r-- 2.7 KB
docker-steps.yml -rw-r--r-- 2.2 KB
docs-steps.yml -rw-r--r-- 1.3 KB
macos-steps.yml -rw-r--r-- 724 bytes
posix-deps.sh -rwxr-xr-x 590 bytes
posix-steps.yml -rw-r--r-- 1.9 KB
pr.yml -rw-r--r-- 1.8 KB
prebuild-checks.yml -rw-r--r-- 1.2 KB
windows-steps.yml -rw-r--r-- 1.1 KB

back to top