cpython/Include
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
..
cpython bpo-38376: Fix _PyUnicode_CheckConsistency() definition (GH-16623) 2019-10-07 21:12:05 +02:00
internal [3.8] bpo-36389: Backport debug enhancements from master (GH-16796) 2019-10-15 03:06:16 +02:00
Python-ast.h bpo-37593: Swap the positions of posonlyargs and args in the constructor of ast.parameters nodes (GH-14778) 2019-07-14 16:49:52 -07:00
Python.h bpo-36763: Implement the PEP 587 (GH-13592) 2019-05-27 16:39:22 +02:00
abstract.h bpo-33407: Implement Py_DEPRECATED() on MSVC (GH-8980) 2019-05-28 17:16:33 +02:00
asdl.h bpo-18407: ast.c uses Py_ssize_t for asdl_seq_LEN() iterator (GH-10655) 2018-11-22 14:45:16 +01:00
ast.h bpo-35177: Add dependencies between header files (GH-10361) 2018-11-12 00:56:19 +01:00
bitset.h bpo-36623: Clean parser headers and include files (GH-12253) 2019-04-13 17:05:14 +01:00
bltinmodule.h these builtins have to be initialized 2009-05-09 18:10:51 +00:00
boolobject.h #1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and Py_REFCNT. 2007-12-19 02:45:37 +00:00
bytearrayobject.h fix comment 2013-10-05 16:28:04 -04:00
bytes_methods.h bpo-32677: Add .isascii() to str, bytes and bytearray (GH-5342) 2018-01-27 14:06:21 +09:00
bytesobject.h bpo-32150: Expand tabs to spaces in C files. (#4583) 2017-11-28 17:56:10 +02:00
cellobject.h bpo-32150: Expand tabs to spaces in C files. (#4583) 2017-11-28 17:56:10 +02:00
ceval.h bpo-33407: Implement Py_DEPRECATED() on MSVC (GH-8980) 2019-05-28 17:16:33 +02:00
classobject.h bpo-36974: implement PEP 590 (GH-13185) 2019-05-29 20:31:52 +02:00
code.h bpo-37221: Add PyCode_NewWithPosOnlyArgs to be used internally and set PyCode_New as a compatibility wrapper (GH-13959) (#14505) 2019-07-01 13:29:14 +02:00
codecs.h Issue #29058: All stable API extensions added after Python 3.2 are now 2016-12-27 14:57:39 +02:00
compile.h bpo-37253: Add _PyCompilerFlags_INIT macro (GH-14018) 2019-06-12 17:36:03 -07:00
complexobject.h Issue #21803: remove macro indirections in complexobject.h 2014-07-07 18:49:30 -04:00
context.h bpo-34762: Fix contextvars C API to use PyObject* pointer types. (GH-9473) 2018-09-21 15:33:56 -04:00
datetime.h bpo-35081: Remove Py_BUILD_CORE from datetime.h (GH-10416) 2018-11-13 09:02:25 +01:00
descrobject.h [3.8] bpo-36974: separate vectorcall functions for each calling convention (GH-13781) (#14782) 2019-07-23 12:39:51 +02:00
dictobject.h bpo-35134: Create Include/cpython/dictobject.h (GH-10732) 2018-11-27 00:12:26 +01:00
dtoa.h Issue #14521: Make result of float('nan') and float('-nan') more consistent across platforms. Further, don't rely on Py_HUGE_VAL for float('inf'). 2012-04-29 15:31:56 +01:00
dynamic_annotations.h fix instances of consecutive articles (closes #23221) 2015-01-13 09:17:24 -05:00
enumobject.h
errcode.h bpo-32150: Expand tabs to spaces in C files. (#4583) 2017-11-28 17:56:10 +02:00
eval.h bpo-32240: Add the const qualifier to declarations of PyObject* array arguments. (#4746) 2017-12-15 13:11:11 +02:00
fileobject.h bpo-36842: Implement PEP 578 (GH-12613) 2019-05-23 08:45:22 -07:00
fileutils.h bpo-37834: Normalise handling of reparse points on Windows (GH-15370) 2019-08-21 15:52:42 -07:00
floatobject.h Issue #11734: Add support for IEEE 754 half-precision floats to the struct module. Original patch by Eli Stevens. 2016-09-03 17:21:29 +01:00
frameobject.h bpo-35134: Split traceback.h header (GH-13430) 2019-05-20 00:14:57 +02:00
funcobject.h bpo-36974: rename _FastCallKeywords -> _Vectorcall (GH-13653) 2019-05-30 15:11:22 +02:00
genobject.h bpo-30773: Fix ag_running; prohibit running athrow/asend/aclose in parallel (GH-7468) (#16486) 2019-09-29 23:19:02 -07:00
graminit.h bpo-35766: Merge typed_ast back into CPython (GH-11645) 2019-01-31 12:40:27 +01:00
grammar.h fix warnings by adding more const (GH-12924) 2019-04-23 20:39:37 +09:00
import.h bpo-36900: import.c uses PyInterpreterState.core_config (GH-13278) 2019-05-13 17:12:45 +02:00
interpreteridobject.h bpo-36097: Use only public C-API in the_xxsubinterpreters module (adding as necessary). (gh-12359) 2019-03-15 16:35:46 -06:00
intrcheck.h bpo-33407: Implement Py_DEPRECATED() on MSVC (GH-8980) 2019-05-28 17:16:33 +02:00
iterobject.h Rename _PyIter_GetBuiltin to _PyObject_GetBuiltin, and do not include it in the stable ABI. 2012-04-05 00:04:20 +02:00
listobject.h bpo-29867: Add asserts in PyTuple_GET_SIZE, PyList_GET_SIZE and PySet_GET_SIZE. (#751) 2017-04-22 01:48:11 +02:00
longintrepr.h bpo-32150: Expand tabs to spaces in C files. (#4583) 2017-11-28 17:56:10 +02:00
longobject.h bpo-33407: Implement Py_DEPRECATED() on MSVC (GH-8980) 2019-05-28 17:16:33 +02:00
marshal.h Issue #1772673: The type of `char*` arguments now changed to `const char*`. 2013-10-19 21:03:34 +03:00
memoryobject.h Issue #29058: All stable API extensions added after Python 3.2 are now 2016-12-27 14:57:39 +02:00
methodobject.h [3.8] bpo-36974: separate vectorcall functions for each calling convention (GH-13781) (#14782) 2019-07-23 12:39:51 +02:00
modsupport.h [3.8] bpo-37034: Display argument name on errors with keyword arguments with Argument Clinic. (GH-13593). (GH-15599) 2019-08-29 18:29:59 +03:00
moduleobject.h bpo-33407: Implement Py_DEPRECATED() on MSVC (GH-8980) 2019-05-28 17:16:33 +02:00
namespaceobject.h Issue #26900: Excluded underscored names and other private API from limited API. 2016-09-11 11:03:14 +03:00
node.h bpo-33416: Add end positions to Python AST (GH-11605) 2019-01-22 11:18:22 +00:00
object.h bpo-32388: Remove cross-version binary compatibility requirement in tp_flags (GH-4944) 2019-05-29 22:12:38 +02:00
objimpl.h bpo-35810: Incref heap-allocated types in PyObject_Init (GH-11661) 2019-03-27 12:52:18 +01:00
odictobject.h bpo-35059: Add _PyObject_CAST() macro (GH-10645) 2018-11-22 02:57:29 +01:00
opcode.h Update opcode.h header comment to mention the source data file (GH-9935) 2018-10-18 14:53:18 -05:00
osdefs.h bpo-31904: Add cross-build support for VxWorks RTOS (GH-11968) 2019-02-27 12:09:28 +01:00
osmodule.h Issue #29058: All stable API extensions added after Python 3.2 are now 2016-12-27 14:57:39 +02:00
parsetok.h bpo-35975: Support parsing earlier minor versions of Python 3 (GH-12086) 2019-03-07 12:38:08 -08:00
patchlevel.h Post v3.8.0 2019-10-14 22:02:48 +02:00
picklebufobject.h bpo-36785: PEP 574 implementation (GH-7076) 2019-05-26 17:10:09 +02:00
py_curses.h bpo-20171: Convert the _curses and _curses_panel modules to Argument Clinic. (GH-4251) 2018-05-10 11:27:23 +03:00
pyarena.h Merge branches/pep-0384. 2010-12-03 20:14:31 +00:00
pycapsule.h Merged revisions 88517 via svnmerge from 2011-02-22 23:43:57 +00:00
pyctype.h Try to fix linking failures under Windows 2011-10-04 14:43:47 +02:00
pydebug.h bpo-32125: Remove Py_UseClassExceptionsFlag flag (#4544) 2017-11-24 22:06:38 +01:00
pydtrace.d bpo-36842: Implement PEP 578 (GH-12613) 2019-05-23 08:45:22 -07:00
pydtrace.h bpo-36842: Implement PEP 578 (GH-12613) 2019-05-23 08:45:22 -07:00
pyerrors.h [3.8] bpo-37757: Disallow PEP 572 cases that expose implementation details (GH-15491) 2019-08-26 00:41:47 +10:00
pyexpat.h bpo-34623: Use XML_SetHashSalt in _elementtree (GH-9146) 2018-09-18 05:38:58 -07:00
pyfpe.h bpo-29137: Remove fpectl module (#4789) 2018-01-05 23:15:34 -08:00
pyhash.h Fix typos mostly in comments, docs and test names (GH-15209) 2019-08-30 13:42:54 -07:00
pylifecycle.h bpo-36763: Make Py_BytesMain() public (GH-15532) 2019-08-26 16:17:56 -07:00
pymacconfig.h Minor spelling fixes 2016-08-20 08:03:06 +00:00
pymacro.h bpo-38205: Py_UNREACHABLE() calls Py_FatalError() (GH-16290) (GH-16306) 2019-09-20 23:36:32 +02:00
pymath.h bpo-31373: fix undefined floating-point demotions (#3396) 2017-09-07 11:13:59 -07:00
pymem.h bpo-35134: Add Include/cpython/pymem.h (GH-12840) 2019-04-15 17:00:19 +02:00
pyport.h closes bpo-38253: Fix typo of Py_SET_ERANGE_IF_OVERFLOW in pyport.h. (GH-16230) 2019-09-23 19:41:06 -07:00
pystate.h bpo-36124: Add PyInterpreterState.dict. (gh-12132) 2019-03-15 17:47:43 -06:00
pystrcmp.h Merged revisions 59541-59561 via svnmerge from 2007-12-19 02:07:34 +00:00
pystrhex.h bpo-22385: Support output separators in hex methods. (#13578) 2019-05-29 11:46:58 -07:00
pystrtod.h Issue #26331: Implement the parsing part of PEP 515. 2016-09-09 14:57:09 -07:00
pythonrun.h bpo-37189: Export old PyRun_XXX() functions (GH-14142) 2019-06-17 15:42:30 -07:00
pythread.h bpo-37077: Add native thread ID (TID) for AIX (GH-13624) 2019-06-13 15:54:04 -07:00
pytime.h Fix _PyTime_MIN/MAX values (GH-15384) (GH-15426) 2019-08-23 17:17:52 +01:00
rangeobject.h #1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and Py_REFCNT. 2007-12-19 02:45:37 +00:00
setobject.h bpo-29867: Add asserts in PyTuple_GET_SIZE, PyList_GET_SIZE and PySet_GET_SIZE. (#751) 2017-04-22 01:48:11 +02:00
sliceobject.h bpo-33407: Implement Py_DEPRECATED() on MSVC (GH-8980) 2019-05-28 17:16:33 +02:00
structmember.h Issue #28761: The fields name and doc of structures PyMemberDef, PyGetSetDef, 2016-11-22 07:58:08 +02:00
structseq.h Issue #28761: The fields name and doc of structures PyMemberDef, PyGetSetDef, 2016-11-22 07:58:08 +02:00
symtable.h [3.8] bpo-37757: Disallow PEP 572 cases that expose implementation details (GH-15491) 2019-08-26 00:41:47 +10:00
sysmodule.h bpo-36842: Implement PEP 578 (GH-12613) 2019-05-23 08:45:22 -07:00
token.h bpo-35975: Support parsing earlier minor versions of Python 3 (GH-12086) 2019-03-07 12:38:08 -08:00
traceback.h bpo-35134: Split traceback.h header (GH-13430) 2019-05-20 00:14:57 +02:00
tracemalloc.h bpo-35053: Define _PyTraceMalloc_NewReference in object.h (GH-10107) 2018-10-26 00:01:56 +02:00
tupleobject.h bpo-35134: Create Include/cpython/tupleobject.h (GH-10764) 2018-11-28 13:01:32 +01:00
typeslots.h Issue 24365: Conditionalize PEP 489 additions to the stable ABI 2015-06-02 19:06:47 -04:00
ucnhash.h Removed unintentional trailing spaces in non-external and non-generated C files. 2015-03-18 21:53:15 +02:00
unicodeobject.h bpo-38376: Fix _PyUnicode_CheckConsistency() definition (GH-16623) 2019-10-07 21:12:05 +02:00
warnings.h bpo-32591: Add native coroutine origin tracking (#5250) 2018-01-21 09:44:07 -05:00
weakrefobject.h Closes #13867: remove untrue comment about PyWeakref_Check(). 2013-10-08 19:50:26 +02:00