Skip to content

Commit a544773

Browse files
authored
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.
1 parent 09895c2 commit a544773

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

Include/internal/pycore_pymem.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ PyAPI_FUNC(int) _PyMem_SetDefaultAllocator(
162162
- PYMEM_DEADBYTE dead (newly freed) memory
163163
- PYMEM_FORBIDDENBYTE: untouchable bytes at each end of a block
164164
165-
Byte patterns 0xCB, 0xBB and 0xFB have been replaced with 0xCD, 0xDD and
165+
Byte patterns 0xCB, 0xDB and 0xFB have been replaced with 0xCD, 0xDD and
166166
0xFD to use the same values than Windows CRT debug malloc() and free().
167167
If modified, _PyMem_IsPtrFreed() should be updated as well. */
168168
#define PYMEM_CLEANBYTE 0xCD

Modules/gcmodule.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1921,6 +1921,8 @@ _PyGC_Dump(PyGC_Head *g)
19211921
_PyObject_Dump(FROM_GC(g));
19221922
}
19231923

1924+
1925+
#ifdef Py_DEBUG
19241926
static int
19251927
visit_validate(PyObject *op, void *parent_raw)
19261928
{
@@ -1931,6 +1933,7 @@ visit_validate(PyObject *op, void *parent_raw)
19311933
}
19321934
return 0;
19331935
}
1936+
#endif
19341937

19351938

19361939
/* extension modules might be compiled with GC support so these

0 commit comments

Comments
 (0)