|
9 | 9 | import warnings
|
10 | 10 |
|
11 | 11 |
|
| 12 | +MS_WINDOWS = (sys.platform == 'win32') |
| 13 | + |
| 14 | + |
12 | 15 | def normalize_text(text):
|
13 | 16 | if text is None:
|
14 | 17 | return None
|
@@ -125,13 +128,21 @@ def collect_sys(info_add):
|
125 | 128 | encoding = '%s/%s' % (encoding, errors)
|
126 | 129 | info_add('sys.%s.encoding' % name, encoding)
|
127 | 130 |
|
128 |
| - # Were we compiled --with-pydebug or with #define Py_DEBUG? |
| 131 | + # Were we compiled --with-pydebug? |
129 | 132 | Py_DEBUG = hasattr(sys, 'gettotalrefcount')
|
130 | 133 | if Py_DEBUG:
|
131 | 134 | text = 'Yes (sys.gettotalrefcount() present)'
|
132 | 135 | else:
|
133 | 136 | text = 'No (sys.gettotalrefcount() missing)'
|
134 |
| - info_add('Py_DEBUG', text) |
| 137 | + info_add('build.Py_DEBUG', text) |
| 138 | + |
| 139 | + # Were we compiled --with-trace-refs? |
| 140 | + Py_TRACE_REFS = hasattr(sys, 'getobjects') |
| 141 | + if Py_TRACE_REFS: |
| 142 | + text = 'Yes (sys.getobjects() present)' |
| 143 | + else: |
| 144 | + text = 'No (sys.getobjects() missing)' |
| 145 | + info_add('build.Py_REF_DEBUG', text) |
135 | 146 |
|
136 | 147 |
|
137 | 148 | def collect_platform(info_add):
|
@@ -444,6 +455,11 @@ def collect_datetime(info_add):
|
444 | 455 |
|
445 | 456 |
|
446 | 457 | def collect_sysconfig(info_add):
|
| 458 | + # On Windows, sysconfig is not reliable to get macros used |
| 459 | + # to build Python |
| 460 | + if MS_WINDOWS: |
| 461 | + return |
| 462 | + |
447 | 463 | import sysconfig
|
448 | 464 |
|
449 | 465 | for name in (
|
@@ -477,6 +493,28 @@ def collect_sysconfig(info_add):
|
477 | 493 | value = normalize_text(value)
|
478 | 494 | info_add('sysconfig[%s]' % name, value)
|
479 | 495 |
|
| 496 | + PY_CFLAGS = sysconfig.get_config_var('PY_CFLAGS') |
| 497 | + NDEBUG = (PY_CFLAGS and '-DNDEBUG' in PY_CFLAGS) |
| 498 | + if NDEBUG: |
| 499 | + text = 'ignore assertions (macro defined)' |
| 500 | + else: |
| 501 | + text= 'build assertions (macro not defined)' |
| 502 | + info_add('build.NDEBUG',text) |
| 503 | + |
| 504 | + for name in ( |
| 505 | + 'WITH_DOC_STRINGS', |
| 506 | + 'WITH_DTRACE', |
| 507 | + 'WITH_FREELISTS', |
| 508 | + 'WITH_PYMALLOC', |
| 509 | + 'WITH_VALGRIND', |
| 510 | + ): |
| 511 | + value = sysconfig.get_config_var(name) |
| 512 | + if value: |
| 513 | + text = 'Yes' |
| 514 | + else: |
| 515 | + text = 'No' |
| 516 | + info_add(f'build.{name}', text) |
| 517 | + |
480 | 518 |
|
481 | 519 | def collect_ssl(info_add):
|
482 | 520 | import os
|
@@ -588,7 +626,6 @@ def collect_testcapi(info_add):
|
588 | 626 | return
|
589 | 627 |
|
590 | 628 | call_func(info_add, 'pymem.allocator', _testcapi, 'pymem_getallocatorsname')
|
591 |
| - copy_attr(info_add, 'pymem.with_pymalloc', _testcapi, 'WITH_PYMALLOC') |
592 | 629 |
|
593 | 630 |
|
594 | 631 | def collect_resource(info_add):
|
@@ -630,6 +667,13 @@ def collect_test_support(info_add):
|
630 | 667 | call_func(info_add, 'test_support._is_gui_available', support, '_is_gui_available')
|
631 | 668 | call_func(info_add, 'test_support.python_is_optimized', support, 'python_is_optimized')
|
632 | 669 |
|
| 670 | + info_add('test_support.check_sanitizer(address=True)', |
| 671 | + support.check_sanitizer(address=True)) |
| 672 | + info_add('test_support.check_sanitizer(memory=True)', |
| 673 | + support.check_sanitizer(memory=True)) |
| 674 | + info_add('test_support.check_sanitizer(ub=True)', |
| 675 | + support.check_sanitizer(ub=True)) |
| 676 | + |
633 | 677 |
|
634 | 678 | def collect_cc(info_add):
|
635 | 679 | import subprocess
|
|
0 commit comments