cpython/Include
Victor Stinner 9e23f0a27c
[3.7] bpo-36389: _PyObject_IsFreed() now also detects uninitialized memory (GH-12770) (GH-12788)
* bpo-36389: _PyObject_IsFreed() now also detects uninitialized memory (GH-12770)

Replace _PyMem_IsFreed() function with _PyMem_IsPtrFreed() inline
function. The function is now way more efficient, it became a simple
comparison on integers, rather than a short loop. It detects also
uninitialized bytes and "forbidden bytes" filled by debug hooks
on memory allocators.

Add unit tests on _PyObject_IsFreed().

(cherry picked from commit 2b00db6855)

* bpo-36389: Change PyMem_SetupDebugHooks() constants (GH-12782)

Modify CLEANBYTE, DEADDYTE and FORBIDDENBYTE constants: use 0xCD,
0xDD and 0xFD, rather than 0xCB, 0xBB and 0xFB, to use the same byte
patterns than Windows CRT debug malloc() and free().

(cherry picked from commit 4c409beb4c)
2019-04-11 22:30:31 +02:00
..
internal [3.7] bpo-36389: _PyObject_IsFreed() now also detects uninitialized memory (GH-12770) (GH-12788) 2019-04-11 22:30:31 +02:00
Python-ast.h bpo-32911: Revert bpo-29463. (GH-7121) 2018-05-29 10:49:10 +03:00
Python.h bpo-28503: Use crypt_r() when available instead of crypt() (GH-11373) (GH-11376) 2018-12-30 17:59:52 -08:00
abstract.h bpo-36317: Fix typo in _PyObject_FastCallDict documentation (GH-12383) (GH-12402) 2019-03-18 12:51:23 +01:00
accu.h
asdl.h
ast.h [3.7] bpo-33475: Fix and improve converting annotations to strings. (GH-6774). (GH-6927) 2018-05-20 18:06:08 +03:00
bitset.h bpo-32150: Expand tabs to spaces in C files. (#4583) 2017-11-28 17:56:10 +02:00
bltinmodule.h
boolobject.h
bytearrayobject.h
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-35444: Fix error handling when fail to look up builtin "getattr". (GH-11047) (GH-11107) 2018-12-11 10:51:27 +02:00
classobject.h bpo-32150: Expand tabs to spaces in C files. (#4583) 2017-11-28 17:56:10 +02:00
code.h String annotations [PEP 563] (#4390) 2018-01-26 08:20:18 -08:00
codecs.h
compile.h String annotations [PEP 563] (#4390) 2018-01-26 08:20:18 -08:00
complexobject.h
context.h bpo-34762: Fix contextvars C API to use PyObject* pointer types. (GH-9473) 2018-09-21 12:48:10 -07:00
datetime.h bpo-10381: Add timezone to datetime C API (#5032) 2018-01-24 17:29:30 -05:00
descrobject.h bpo-32240: Add the const qualifier to declarations of PyObject* array arguments. (#4746) 2017-12-15 13:11:11 +02:00
dictobject.h
dtoa.h
dynamic_annotations.h
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-29240: PEP 540: Add a new UTF-8 Mode (#855) 2017-12-13 12:29:09 +01:00
fileutils.h bpo-34523: Fix C locale coercion on FreeBSD CURRENT (GH-10672) (GH-10673) 2018-11-23 13:37:42 +01:00
floatobject.h
frameobject.h Move exc state to generator. Fixes bpo-25612 (#1773) 2017-10-22 23:41:51 +02:00
funcobject.h bpo-32240: Add the const qualifier to declarations of PyObject* array arguments. (#4746) 2017-12-15 13:11:11 +02:00
genobject.h bpo-32591: Add native coroutine origin tracking (#5250) 2018-01-21 09:44:07 -05:00
graminit.h bpo-30406: Make async and await proper keywords (#1669) 2017-10-05 23:24:46 -04:00
grammar.h bpo-32150: Expand tabs to spaces in C files. (#4583) 2017-11-28 17:56:10 +02:00
import.h Fix redundant declaration of _PyImport_AddModuleObject (GH-7992) 2018-06-29 16:03:07 -07:00
intrcheck.h [3.7] Add missed details of the C API introduced in 3.7. (GH-7047) (GH-7061) 2018-05-22 22:26:42 +03:00
iterobject.h
listobject.h
longintrepr.h bpo-32150: Expand tabs to spaces in C files. (#4583) 2017-11-28 17:56:10 +02:00
longobject.h
marshal.h
memoryobject.h
metagrammar.h
methodobject.h bpo-32240: Add the const qualifier to declarations of PyObject* array arguments. (#4746) 2017-12-15 13:11:11 +02:00
modsupport.h bpo-32240: Add the const qualifier to declarations of PyObject* array arguments. (#4746) 2017-12-15 13:11:11 +02:00
moduleobject.h
namespaceobject.h
node.h bpo-32150: Expand tabs to spaces in C files. (#4583) 2017-11-28 17:56:10 +02:00
object.h [3.7] bpo-9263: _PyObject_Dump() detects freed memory (GH-10061) (GH-10662) 2018-11-22 17:15:37 +01:00
objimpl.h Fix typo in Include/objimpl.h, the word "has" was missing (GH-5568) (GH-5569) 2018-02-11 23:33:11 -08:00
odictobject.h bpo-29084: Exclude C API for OrderedDict from the limited C API. (#4900) 2017-12-25 02:08:42 +02:00
opcode.h bpo-32550. Remove the STORE_ANNOTATION bytecode. (GH-5181) 2018-01-29 16:41:04 -08:00
osdefs.h
osmodule.h
parsetok.h bpo-32150: Expand tabs to spaces in C files. (#4583) 2017-11-28 17:56:10 +02:00
patchlevel.h bump to 3.7.3+ 2019-03-25 19:31:06 -04:00
pgen.h
pgenheaders.h bpo-32150: Expand tabs to spaces in C files. (#4583) 2017-11-28 17:56:10 +02:00
py_curses.h bpo-32593: Drop FreeBSD 9 and older support (#5232) 2018-01-22 18:32:50 +01:00
pyarena.h
pyatomic.h
pycapsule.h
pyctype.h
pydebug.h bpo-32125: Remove Py_UseClassExceptionsFlag flag (#4544) 2017-11-24 22:06:38 +01:00
pydtrace.d bpo-31574: importlib dtrace (#3749) 2017-09-29 15:53:19 -07:00
pydtrace.h bpo-31574: importlib dtrace (#3749) 2017-09-29 15:53:19 -07:00
pyerrors.h [3.7] bpo-35147: Fix _Py_NO_RETURN for GCC (GH-10300) (GH-10301) 2018-11-02 18:30:11 -07:00
pyexpat.h bpo-34623: Use XML_SetHashSalt in _elementtree (GH-9146) 2018-09-18 06:11:09 -07:00
pyfpe.h bpo-29137: Remove fpectl module (#4789) 2018-01-05 23:15:34 -08:00
pyhash.h Correct the location of a function mentioned in a comment (GH-4327) 2017-11-09 19:55:34 +03:00
pylifecycle.h bpo-36236: Handle removed cwd at Python init (GH-12450) 2019-03-20 00:30:45 +01:00
pymacconfig.h
pymacro.h
pymath.h
pymem.h [3.7] bpo-36389: _PyObject_IsFreed() now also detects uninitialized memory (GH-12770) (GH-12788) 2019-04-11 22:30:31 +02:00
pyport.h bpo-32593: Drop FreeBSD 9 and older support (#5232) 2018-01-22 18:32:50 +01:00
pystate.h Revert "[3.7] bpo-34589: Add -X coerce_c_locale option; C locale coercion off by default (GH-9379)" (GH-9416) 2018-09-19 12:01:52 -07:00
pystrcmp.h
pystrhex.h
pystrtod.h
pythonrun.h
pythread.h bpo-30768: Recompute timeout on interrupted lock (GH-4103) 2017-10-24 16:53:32 -07:00
pytime.h bpo-31784: Implement PEP 564: add time.time_ns() (#3989) 2017-11-02 07:28:27 -07:00
rangeobject.h
setobject.h
sliceobject.h bpo-32150: Expand tabs to spaces in C files. (#4583) 2017-11-28 17:56:10 +02:00
structmember.h
structseq.h
symtable.h bpo-32836: Remove obsolete code from symtable pass (GH-5680) 2018-03-10 15:11:47 -08:00
sysmodule.h bpo-32030: Add _PyPathConfig_ComputeArgv0() (#4845) 2017-12-13 21:05:57 +01:00
token.h bpo-30406: Make async and await proper keywords (#1669) 2017-10-05 23:24:46 -04:00
traceback.h
tupleobject.h Fix small typo in tupleobject.h (#4801) 2017-12-12 09:59:30 +02:00
typeslots.h
ucnhash.h
unicodeobject.h bpo-33954: Fix _PyUnicode_InsertThousandsGrouping() (GH-10623) (GH-10718) 2018-11-26 14:17:01 +01:00
warnings.h bpo-32591: Add native coroutine origin tracking (#5250) 2018-01-21 09:44:07 -05:00
weakrefobject.h