summaryrefslogtreecommitdiffstats
path: root/Include/internal
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2019-04-11 11:01:15 (GMT)
committerGitHub <noreply@github.com>2019-04-11 11:01:15 (GMT)
commit4c409beb4c360a73d054f37807d3daad58d1b567 (patch)
tree03e835b35a2c910cd4793106eee2004212644746 /Include/internal
parent536a35b3f14888999f1ffa5be7239d0c26b73d7a (diff)
downloadcpython-4c409beb4c360a73d054f37807d3daad58d1b567.zip
cpython-4c409beb4c360a73d054f37807d3daad58d1b567.tar.gz
cpython-4c409beb4c360a73d054f37807d3daad58d1b567.tar.bz2
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().
Diffstat (limited to 'Include/internal')
-rw-r--r--Include/internal/pycore_pymem.h19
1 files changed, 9 insertions, 10 deletions
diff --git a/Include/internal/pycore_pymem.h b/Include/internal/pycore_pymem.h
index 78d457d..8da1bd9 100644
--- a/Include/internal/pycore_pymem.h
+++ b/Include/internal/pycore_pymem.h
@@ -160,21 +160,20 @@ PyAPI_FUNC(int) _PyMem_SetDefaultAllocator(
pointer value is checked.
The heuristic relies on the debug hooks on Python memory allocators which
- fills newly allocated memory with CLEANBYTE (0xCB) and newly freed memory
- with DEADBYTE (0xDB). Detect also "untouchable bytes" marked
- with FORBIDDENBYTE (0xFB). */
+ fills newly allocated memory with CLEANBYTE (0xCD) and newly freed memory
+ with DEADBYTE (0xDD). Detect also "untouchable bytes" marked
+ with FORBIDDENBYTE (0xFD). */
static inline int _PyMem_IsPtrFreed(void *ptr)
{
uintptr_t value = (uintptr_t)ptr;
#if SIZEOF_VOID_P == 8
- return (value == (uintptr_t)0xCBCBCBCBCBCBCBCB
- || value == (uintptr_t)0xDBDBDBDBDBDBDBDB
- || value == (uintptr_t)0xFBFBFBFBFBFBFBFB
- );
+ return (value == (uintptr_t)0xCDCDCDCDCDCDCDCD
+ || value == (uintptr_t)0xDDDDDDDDDDDDDDDD
+ || value == (uintptr_t)0xFDFDFDFDFDFDFDFD);
#elif SIZEOF_VOID_P == 4
- return (value == (uintptr_t)0xCBCBCBCB
- || value == (uintptr_t)0xDBDBDBDB
- || value == (uintptr_t)0xFBFBFBFB);
+ return (value == (uintptr_t)0xCDCDCDCD
+ || value == (uintptr_t)0xDDDDDDDD
+ || value == (uintptr_t)0xFDFDFDFD);
#else
# error "unknown pointer size"
#endif