]> granicus.if.org Git - python/commitdiff
pythoninfo: add Py_DEBUG (#4198) (#4580)
authorVictor Stinner <victor.stinner@gmail.com>
Mon, 27 Nov 2017 09:44:53 +0000 (10:44 +0100)
committerGitHub <noreply@github.com>
Mon, 27 Nov 2017 09:44:53 +0000 (10:44 +0100)
(cherry picked from commit afd055a59fe0291881fc2459215ce106e424da51)

Lib/test/pythoninfo.py

index 5447ab8274b4e7d95eb4d04bf2c8a8350073d574..c238ef7b75c5bd6db4de21e5299590b7cb871504 100644 (file)
@@ -115,6 +115,14 @@ def collect_sys(info_add):
             encoding = '%s/%s' % (encoding, errors)
         info_add('sys.%s.encoding' % name, encoding)
 
+    # Were we compiled --with-pydebug or with #define Py_DEBUG?
+    Py_DEBUG = hasattr(sys, 'gettotalrefcount')
+    if Py_DEBUG:
+        text = 'Yes (sys.gettotalrefcount() present)'
+    else:
+        text = 'No (sys.gettotalrefcount() missing)'
+    info_add('Py_DEBUG', text)
+
 
 def collect_platform(info_add):
     import platform