bpo-38392: Only declare visit_validate() if Py_DEBUG is defined (GH-1… · python/cpython@a544773

2 files changed

lines changed

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

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