|
10 | 10 | import warnings
|
11 | 11 |
|
12 | 12 |
|
| 13 | +MS_WINDOWS = (sys.platform == 'win32') |
| 14 | + |
| 15 | + |
13 | 16 | def normalize_text(text):
|
14 | 17 | if text is None:
|
15 | 18 | return None
|
@@ -127,13 +130,21 @@ def collect_sys(info_add):
|
127 | 130 | encoding = '%s/%s' % (encoding, errors)
|
128 | 131 | info_add('sys.%s.encoding' % name, encoding)
|
129 | 132 |
|
130 |
| - # Were we compiled --with-pydebug or with #define Py_DEBUG? |
| 133 | + # Were we compiled --with-pydebug? |
131 | 134 | Py_DEBUG = hasattr(sys, 'gettotalrefcount')
|
132 | 135 | if Py_DEBUG:
|
133 | 136 | text = 'Yes (sys.gettotalrefcount() present)'
|
134 | 137 | else:
|
135 | 138 | text = 'No (sys.gettotalrefcount() missing)'
|
136 |
| - info_add('Py_DEBUG', text) |
| 139 | + info_add('build.Py_DEBUG', text) |
| 140 | + |
| 141 | + # Were we compiled --with-trace-refs? |
| 142 | + Py_TRACE_REFS = hasattr(sys, 'getobjects') |
| 143 | + if Py_TRACE_REFS: |
| 144 | + text = 'Yes (sys.getobjects() present)' |
| 145 | + else: |
| 146 | + text = 'No (sys.getobjects() missing)' |
| 147 | + info_add('build.Py_REF_DEBUG', text) |
137 | 148 |
|
138 | 149 |
|
139 | 150 | def collect_platform(info_add):
|
@@ -455,6 +466,11 @@ def collect_datetime(info_add):
|
455 | 466 |
|
456 | 467 |
|
457 | 468 | def collect_sysconfig(info_add):
|
| 469 | + # On Windows, sysconfig is not reliable to get macros used |
| 470 | + # to build Python |
| 471 | + if MS_WINDOWS: |
| 472 | + return |
| 473 | + |
458 | 474 | import sysconfig
|
459 | 475 |
|
460 | 476 | for name in (
|
@@ -488,6 +504,28 @@ def collect_sysconfig(info_add):
|
488 | 504 | value = normalize_text(value)
|
489 | 505 | info_add('sysconfig[%s]' % name, value)
|
490 | 506 |
|
| 507 | + PY_CFLAGS = sysconfig.get_config_var('PY_CFLAGS') |
| 508 | + NDEBUG = (PY_CFLAGS and '-DNDEBUG' in PY_CFLAGS) |
| 509 | + if NDEBUG: |
| 510 | + text = 'ignore assertions (macro defined)' |
| 511 | + else: |
| 512 | + text= 'build assertions (macro not defined)' |
| 513 | + info_add('build.NDEBUG',text) |
| 514 | + |
| 515 | + for name in ( |
| 516 | + 'WITH_DOC_STRINGS', |
| 517 | + 'WITH_DTRACE', |
| 518 | + 'WITH_FREELISTS', |
| 519 | + 'WITH_PYMALLOC', |
| 520 | + 'WITH_VALGRIND', |
| 521 | + ): |
| 522 | + value = sysconfig.get_config_var(name) |
| 523 | + if value: |
| 524 | + text = 'Yes' |
| 525 | + else: |
| 526 | + text = 'No' |
| 527 | + info_add(f'build.{name}', text) |
| 528 | + |
491 | 529 |
|
492 | 530 | def collect_ssl(info_add):
|
493 | 531 | import os
|
@@ -605,7 +643,6 @@ def collect_testcapi(info_add):
|
605 | 643 | return
|
606 | 644 |
|
607 | 645 | call_func(info_add, 'pymem.allocator', _testcapi, 'pymem_getallocatorsname')
|
608 |
| - copy_attr(info_add, 'pymem.with_pymalloc', _testcapi, 'WITH_PYMALLOC') |
609 | 646 |
|
610 | 647 |
|
611 | 648 | def collect_resource(info_add):
|
@@ -647,6 +684,13 @@ def collect_test_support(info_add):
|
647 | 684 | call_func(info_add, 'test_support._is_gui_available', support, '_is_gui_available')
|
648 | 685 | call_func(info_add, 'test_support.python_is_optimized', support, 'python_is_optimized')
|
649 | 686 |
|
| 687 | + info_add('test_support.check_sanitizer(address=True)', |
| 688 | + support.check_sanitizer(address=True)) |
| 689 | + info_add('test_support.check_sanitizer(memory=True)', |
| 690 | + support.check_sanitizer(memory=True)) |
| 691 | + info_add('test_support.check_sanitizer(ub=True)', |
| 692 | + support.check_sanitizer(ub=True)) |
| 693 | + |
650 | 694 |
|
651 | 695 | def collect_cc(info_add):
|
652 | 696 | import subprocess
|
|
0 commit comments