diff --git a/Include/object.h b/Include/object.h index ad452be8405671..4bb2ccc21ce15b 100644 --- a/Include/object.h +++ b/Include/object.h @@ -51,8 +51,8 @@ A standard interface exists for objects that contain an array of items whose size is determined when the object is allocated. */ -/* Py_DEBUG implies Py_REF_DEBUG. */ -#if defined(Py_DEBUG) && !defined(Py_REF_DEBUG) +/* Py_DEBUG implies Py_REF_DEBUG, unless explicitly disabled. */ +#if defined(Py_DEBUG) && !defined(Py_NO_PY_REF_DEBUG) && !defined(Py_REF_DEBUG) # define Py_REF_DEBUG #endif diff --git a/PC/pyconfig.h b/PC/pyconfig.h index a126fca6f5aafb..bf346323d0aa6a 100644 --- a/PC/pyconfig.h +++ b/PC/pyconfig.h @@ -94,8 +94,8 @@ WIN32 is still required for the locale module. #endif #endif /* Py_BUILD_CORE || Py_BUILD_CORE_BUILTIN || Py_BUILD_CORE_MODULE */ -/* _DEBUG implies Py_DEBUG */ -#ifdef _DEBUG +/* _DEBUG implies Py_DEBUG, unless explicitly disabled. */ +#if defined(_DEBUG) && !defined(Py_WIN_NO_PY_DEBUG) && !defined(Py_DEBUG) # define Py_DEBUG 1 #endif