[Python-checkins] bpo-38437: Activate GC_DEBUG when PY_DEBUG is set (GH-16707)

Pablo Galindo webhook-mailer at python.org
Thu Oct 10 17:45:21 EDT 2019


https://github.com/python/cpython/commit/320dd504ddf65efe946e6d1e89053ed2d7ebe1e9
commit: 320dd504ddf65efe946e6d1e89053ed2d7ebe1e9
branch: master
author: Pablo Galindo <Pablogsal at gmail.com>
committer: GitHub <noreply at github.com>
date: 2019-10-10T22:45:17+01:00
summary:

bpo-38437: Activate GC_DEBUG when PY_DEBUG is set (GH-16707)

files:
A Misc/NEWS.d/next/Core and Builtins/2019-10-10-20-42-09.bpo-38437.z_0mZp.rst
M Modules/gcmodule.c

diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-10-10-20-42-09.bpo-38437.z_0mZp.rst b/Misc/NEWS.d/next/Core and Builtins/2019-10-10-20-42-09.bpo-38437.z_0mZp.rst
new file mode 100644
index 0000000000000..69a8843ce0f69
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2019-10-10-20-42-09.bpo-38437.z_0mZp.rst	
@@ -0,0 +1,2 @@
+Activate the ``GC_DEBUG`` macro for debug builds of the interpreter (when
+``Py_DEBUG`` is set). Patch by Pablo Galindo.
diff --git a/Modules/gcmodule.c b/Modules/gcmodule.c
index b1e802e33e498..a1cb323bd24cb 100644
--- a/Modules/gcmodule.c
+++ b/Modules/gcmodule.c
@@ -37,7 +37,10 @@ module gc
 [clinic start generated code]*/
 /*[clinic end generated code: output=da39a3ee5e6b4b0d input=b5c9690ecc842d79]*/
 
-#define GC_DEBUG (0)  /* Enable more asserts */
+
+#ifdef Py_DEBUG
+#  define GC_DEBUG
+#endif
 
 #define GC_NEXT _PyGCHead_NEXT
 #define GC_PREV _PyGCHead_PREV
@@ -316,7 +319,7 @@ append_objects(PyObject *py_list, PyGC_Head *gc_list)
     return 0;
 }
 
-#if GC_DEBUG
+#ifdef GC_DEBUG
 // validate_list checks list consistency.  And it works as document
 // describing when expected_mask is set / unset.
 static void



More information about the Python-checkins mailing list