]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-36389: _PyObject_IsFreed() now also detects uninitialized memory (GH-12770)
authorVictor Stinner <vstinner@redhat.com>
Thu, 11 Apr 2019 09:33:27 +0000 (11:33 +0200)
committerGitHub <noreply@github.com>
Thu, 11 Apr 2019 09:33:27 +0000 (11:33 +0200)
commit2b00db68554422ec37faba2a80179a0172df6349
tree164b39074b3563200714215ea8273c59f173feb5
parent57b1a2862a99677f09614e9e456d36aae9ddd87c
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().
Include/internal/pycore_pymem.h
Include/pymem.h
Lib/test/test_capi.py
Modules/_testcapimodule.c
Objects/object.c
Objects/obmalloc.c