diff options
author | Victor Stinner <vstinner@python.org> | 2019-10-07 20:31:42 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-07 20:31:42 (GMT) |
commit | 60ec6efd96d95476fe5e38c491491add04f026e5 (patch) | |
tree | 9375da43962ba029fc37770f83d1d7f784cb32ca /Include | |
parent | 6876257eaabdb30f27ebcbd7d2557278ce2e5705 (diff) | |
download | cpython-60ec6efd96d95476fe5e38c491491add04f026e5.zip cpython-60ec6efd96d95476fe5e38c491491add04f026e5.tar.gz cpython-60ec6efd96d95476fe5e38c491491add04f026e5.tar.bz2 |
bpo-36389: Fix _PyBytesWriter in release mode (GH-16624)
Fix _PyBytesWriter API when Python is built in release mode with
assertions.
Diffstat (limited to 'Include')
-rw-r--r-- | Include/internal/pycore_pymem.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Include/internal/pycore_pymem.h b/Include/internal/pycore_pymem.h index 5be2d33..d61ff6e 100644 --- a/Include/internal/pycore_pymem.h +++ b/Include/internal/pycore_pymem.h @@ -154,6 +154,21 @@ PyAPI_FUNC(int) _PyMem_SetDefaultAllocator( PyMemAllocatorDomain domain, PyMemAllocatorEx *old_alloc); +/* Special bytes broadcast into debug memory blocks at appropriate times. + Strings of these are unlikely to be valid addresses, floats, ints or + 7-bit ASCII. + + - PYMEM_CLEANBYTE: clean (newly allocated) memory + - PYMEM_DEADBYTE dead (newly freed) memory + - PYMEM_FORBIDDENBYTE: untouchable bytes at each end of a block + + Byte patterns 0xCB, 0xBB and 0xFB have been replaced with 0xCD, 0xDD and + 0xFD to use the same values than Windows CRT debug malloc() and free(). + If modified, _PyMem_IsPtrFreed() should be updated as well. */ +#define PYMEM_CLEANBYTE 0xCD +#define PYMEM_DEADBYTE 0xDD +#define PYMEM_FORBIDDENBYTE 0xFD + /* Heuristic checking if a pointer value is newly allocated (uninitialized), newly freed or NULL (is equal to zero). |