bpo-38392: Only declare visit_validate() if Py_DEBUG is defined (GH-16689)

bpo-38392, bpo-38426: Fix a compiler warning in gcmodule.c.

Fix also a typo in PYMEM_DEADBYTE macro comment.
This commit is contained in:
Victor Stinner 2019-10-10 09:32:13 +02:00 committed by GitHub
parent 09895c27cd
commit a5447735c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View File

@ -162,7 +162,7 @@ PyAPI_FUNC(int) _PyMem_SetDefaultAllocator(
- PYMEM_DEADBYTE dead (newly freed) memory - PYMEM_DEADBYTE dead (newly freed) memory
- PYMEM_FORBIDDENBYTE: untouchable bytes at each end of a block - PYMEM_FORBIDDENBYTE: untouchable bytes at each end of a block
Byte patterns 0xCB, 0xBB and 0xFB have been replaced with 0xCD, 0xDD and Byte patterns 0xCB, 0xDB and 0xFB have been replaced with 0xCD, 0xDD and
0xFD to use the same values than Windows CRT debug malloc() and free(). 0xFD to use the same values than Windows CRT debug malloc() and free().
If modified, _PyMem_IsPtrFreed() should be updated as well. */ If modified, _PyMem_IsPtrFreed() should be updated as well. */
#define PYMEM_CLEANBYTE 0xCD #define PYMEM_CLEANBYTE 0xCD

View File

@ -1921,6 +1921,8 @@ _PyGC_Dump(PyGC_Head *g)
_PyObject_Dump(FROM_GC(g)); _PyObject_Dump(FROM_GC(g));
} }
#ifdef Py_DEBUG
static int static int
visit_validate(PyObject *op, void *parent_raw) visit_validate(PyObject *op, void *parent_raw)
{ {
@ -1931,6 +1933,7 @@ visit_validate(PyObject *op, void *parent_raw)
} }
return 0; return 0;
} }
#endif
/* extension modules might be compiled with GC support so these /* extension modules might be compiled with GC support so these