cpython/Include/internal
Victor Stinner f82ce5b1b1
[3.8] bpo-36389: Backport debug enhancements from master (GH-16796)
* bpo-36389: _PyObject_CheckConsistency() available in release mode (GH-16612)

bpo-36389, bpo-38376: The _PyObject_CheckConsistency() function is
now also available in release mode. For example, it can be used to
debug a crash in the visit_decref() function of the GC.

Modify the following functions to also work in release mode:

* _PyDict_CheckConsistency()
* _PyObject_CheckConsistency()
* _PyType_CheckConsistency()
* _PyUnicode_CheckConsistency()

Other changes:

* _PyMem_IsPtrFreed(ptr) now also returns 1 if ptr is NULL
  (equals to 0).
* _PyBytesWriter_CheckConsistency() now returns 1 and is only used
  with assert().
* Reorder _PyObject_Dump() to write safe fields first, and only
  attempt to render repr() at the end.

(cherry picked from commit 6876257eaa)

* bpo-36389: Fix _PyBytesWriter in release mode (GH-16624)

Fix _PyBytesWriter API when Python is built in release mode with
assertions.

(cherry picked from commit 60ec6efd96)

* bpo-38070: Enhance visit_decref() debug trace (GH-16631)

subtract_refs() now pass the parent object to visit_decref() which
pass it to _PyObject_ASSERT(). So if the "is freed" assertion fails,
the parent is used in debug trace, rather than the freed object. The
parent object is more likely to contain useful information. Freed
objects cannot be inspected are are displayed as "<object at xxx is
freed>" with no other detail.

(cherry picked from commit 4d5f94b8cd)

* Fix also a typo in PYMEM_DEADBYTE macro comment

* bpo-36389: Add newline to _PyObject_AssertFailed() (GH-16629)

Add a newline between the verbose object dump and the Py_FatalError()
logs for readability.

(cherry picked from commit 7775349895)
2019-10-15 03:06:16 +02:00
..
pycore_accu.h bpo-36635: Change pyport.h for Py_BUILD_CORE_MODULE define (GH-12853) 2019-04-17 23:02:26 +02:00
pycore_atomic.h bpo-33608: Normalize atomic macros so that they all expect an atomic struct (GH-12877) 2019-04-22 11:13:11 -07:00
pycore_ceval.h Revert "bpo-33608: Factor out a private, per-interpreter _Py_AddPendingCall(). (gh-13714)" (GH-13780) 2019-06-03 18:14:24 +02:00
pycore_code.h bpo-26219: per opcode cache for LOAD_GLOBAL (GH-12884) 2019-06-03 21:30:58 +09:00
pycore_condvar.h bpo-36635: Change pyport.h for Py_BUILD_CORE_MODULE define (GH-12853) 2019-04-17 23:02:26 +02:00
pycore_context.h bpo-36635: Change pyport.h for Py_BUILD_CORE_MODULE define (GH-12853) 2019-04-17 23:02:26 +02:00
pycore_fileutils.h bpo-36301: Error if decoding pybuilddir.txt fails (GH-12422) 2019-03-19 01:46:25 +01:00
pycore_getopt.h bpo-36763: Cleanup precmdline in _PyCoreConfig_Read() (GH-13371) 2019-05-17 03:15:12 +02:00
pycore_gil.h bpo-36635: Change pyport.h for Py_BUILD_CORE_MODULE define (GH-12853) 2019-04-17 23:02:26 +02:00
pycore_hamt.h bpo-36635: Change pyport.h for Py_BUILD_CORE_MODULE define (GH-12853) 2019-04-17 23:02:26 +02:00
pycore_initconfig.h bpo-38304: PyConfig_InitPythonConfig() cannot fail anymore (GH-16509) 2019-10-01 03:26:04 -07:00
pycore_object.h bpo-38376: Fix _PyUnicode_CheckConsistency() definition (GH-16623) 2019-10-07 21:12:05 +02:00
pycore_pathconfig.h [3.8] bpo-38234: Backport init path config changes from master (GH-16423) 2019-09-26 16:17:34 +02:00
pycore_pyerrors.h bpo-36710: Add tstate parameter in ceval.c (GH-13547) 2019-05-24 17:01:38 +02:00
pycore_pyhash.h bpo-36635: Change pyport.h for Py_BUILD_CORE_MODULE define (GH-12853) 2019-04-17 23:02:26 +02:00
pycore_pylifecycle.h bpo-38317: Fix PyConfig.warnoptions priority (GH-16478) 2019-09-29 16:58:57 -07:00
pycore_pymem.h [3.8] bpo-36389: Backport debug enhancements from master (GH-16796) 2019-10-15 03:06:16 +02:00
pycore_pystate.h [3.8] bpo-38070: Py_FatalError() logs runtime state (GH-16258) 2019-09-18 14:10:16 +02:00
pycore_traceback.h bpo-36829: PyErr_WriteUnraisable() normalizes exception (GH-13507) 2019-05-23 01:00:58 +02:00
pycore_tupleobject.h bpo-36635: Change pyport.h for Py_BUILD_CORE_MODULE define (GH-12853) 2019-04-17 23:02:26 +02:00
pycore_warnings.h bpo-36635: Change pyport.h for Py_BUILD_CORE_MODULE define (GH-12853) 2019-04-17 23:02:26 +02:00