|
22 | 22 |
|
23 | 23 | MS_WINDOWS = (os.name == 'nt') |
24 | 24 | MACOS = (sys.platform == 'darwin') |
25 | | - |
| 25 | +Py_DEBUG = hasattr(sys, 'gettotalrefcount') |
26 | 26 | PYMEM_ALLOCATOR_NOT_SET = 0 |
27 | 27 | PYMEM_ALLOCATOR_DEBUG = 2 |
28 | 28 | PYMEM_ALLOCATOR_MALLOC = 3 |
@@ -478,7 +478,7 @@ class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase): |
478 | 478 | 'pathconfig_warnings': 1, |
479 | 479 | '_init_main': 1, |
480 | 480 | '_isolated_interpreter': 0, |
481 | | - 'use_frozen_modules': 1, |
| 481 | + 'use_frozen_modules': not Py_DEBUG, |
482 | 482 | '_is_python_build': IGNORE_CONFIG, |
483 | 483 | } |
484 | 484 | if MS_WINDOWS: |
@@ -1177,7 +1177,7 @@ def test_init_setpath_config(self): |
1177 | 1177 | # The current getpath.c doesn't determine the stdlib dir |
1178 | 1178 | # in this case. |
1179 | 1179 | 'stdlib_dir': '', |
1180 | | - 'use_frozen_modules': 1, |
| 1180 | + 'use_frozen_modules': not Py_DEBUG, |
1181 | 1181 | # overridden by PyConfig |
1182 | 1182 | 'program_name': 'conf_program_name', |
1183 | 1183 | 'base_executable': 'conf_executable', |
@@ -1416,12 +1416,12 @@ def test_init_pyvenv_cfg(self): |
1416 | 1416 | config['base_prefix'] = pyvenv_home |
1417 | 1417 | config['prefix'] = pyvenv_home |
1418 | 1418 | config['stdlib_dir'] = os.path.join(pyvenv_home, 'Lib') |
1419 | | - config['use_frozen_modules'] = 1 |
| 1419 | + config['use_frozen_modules'] = not Py_DEBUG |
1420 | 1420 | else: |
1421 | 1421 | # cannot reliably assume stdlib_dir here because it |
1422 | 1422 | # depends too much on our build. But it ought to be found |
1423 | 1423 | config['stdlib_dir'] = self.IGNORE_CONFIG |
1424 | | - config['use_frozen_modules'] = 1 |
| 1424 | + config['use_frozen_modules'] = not Py_DEBUG |
1425 | 1425 |
|
1426 | 1426 | env = self.copy_paths_by_env(config) |
1427 | 1427 | self.check_all_configs("test_init_compat_config", config, |
|
0 commit comments