|
22 | 22 |
|
23 | 23 | MS_WINDOWS = (os.name == 'nt') |
24 | 24 | MACOS = (sys.platform == 'darwin') |
25 | | -Py_DEBUG = hasattr(sys, 'gettotalrefcount') |
26 | 25 | PYMEM_ALLOCATOR_NOT_SET = 0 |
27 | 26 | PYMEM_ALLOCATOR_DEBUG = 2 |
28 | 27 | PYMEM_ALLOCATOR_MALLOC = 3 |
@@ -498,7 +497,7 @@ class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase): |
498 | 497 | 'pathconfig_warnings': 1, |
499 | 498 | '_init_main': 1, |
500 | 499 | '_isolated_interpreter': 0, |
501 | | - 'use_frozen_modules': not Py_DEBUG, |
| 500 | + 'use_frozen_modules': not support.Py_DEBUG, |
502 | 501 | 'safe_path': 0, |
503 | 502 | '_is_python_build': IGNORE_CONFIG, |
504 | 503 | } |
@@ -1206,7 +1205,7 @@ def test_init_setpath_config(self): |
1206 | 1205 | # The current getpath.c doesn't determine the stdlib dir |
1207 | 1206 | # in this case. |
1208 | 1207 | 'stdlib_dir': '', |
1209 | | - 'use_frozen_modules': not Py_DEBUG, |
| 1208 | + 'use_frozen_modules': not support.Py_DEBUG, |
1210 | 1209 | # overridden by PyConfig |
1211 | 1210 | 'program_name': 'conf_program_name', |
1212 | 1211 | 'base_executable': 'conf_executable', |
@@ -1445,12 +1444,12 @@ def test_init_pyvenv_cfg(self): |
1445 | 1444 | config['base_prefix'] = pyvenv_home |
1446 | 1445 | config['prefix'] = pyvenv_home |
1447 | 1446 | config['stdlib_dir'] = os.path.join(pyvenv_home, 'Lib') |
1448 | | - config['use_frozen_modules'] = not Py_DEBUG |
| 1447 | + config['use_frozen_modules'] = not support.Py_DEBUG |
1449 | 1448 | else: |
1450 | 1449 | # cannot reliably assume stdlib_dir here because it |
1451 | 1450 | # depends too much on our build. But it ought to be found |
1452 | 1451 | config['stdlib_dir'] = self.IGNORE_CONFIG |
1453 | | - config['use_frozen_modules'] = not Py_DEBUG |
| 1452 | + config['use_frozen_modules'] = not support.Py_DEBUG |
1454 | 1453 |
|
1455 | 1454 | env = self.copy_paths_by_env(config) |
1456 | 1455 | self.check_all_configs("test_init_compat_config", config, |
@@ -1680,7 +1679,7 @@ def test_frozenmain(self): |
1680 | 1679 | """).lstrip() |
1681 | 1680 | self.assertEqual(out, expected) |
1682 | 1681 |
|
1683 | | - @unittest.skipUnless(hasattr(sys, 'gettotalrefcount'), |
| 1682 | + @unittest.skipUnless(support.Py_DEBUG, |
1684 | 1683 | '-X showrefcount requires a Python debug build') |
1685 | 1684 | def test_no_memleak(self): |
1686 | 1685 | # bpo-1635741: Python must release all memory at exit |
|
0 commit comments