Skip to content

Commit d5c71b0

Browse files
authored
pythoninfo: add Py_DEBUG (#4198) (#4580)
(cherry picked from commit afd055a)
1 parent 8a95753 commit d5c71b0

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Lib/test/pythoninfo.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,14 @@ def collect_sys(info_add):
115115
encoding = '%s/%s' % (encoding, errors)
116116
info_add('sys.%s.encoding' % name, encoding)
117117

118+
# Were we compiled --with-pydebug or with #define Py_DEBUG?
119+
Py_DEBUG = hasattr(sys, 'gettotalrefcount')
120+
if Py_DEBUG:
121+
text = 'Yes (sys.gettotalrefcount() present)'
122+
else:
123+
text = 'No (sys.gettotalrefcount() missing)'
124+
info_add('Py_DEBUG', text)
125+
118126

119127
def collect_platform(info_add):
120128
import platform

0 commit comments

Comments
 (0)