| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 88feaec commit 49d99f0
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -15,6 +15,7 @@ | |||
| 15 | 15 | ||
| 16 | 16 | ||
| 17 | 17 | MS_WINDOWS = (os.name == 'nt') | |
| 18 | + MACOS = (sys.platform == 'darwin') | ||
| 18 | 19 | ||
| 19 | 20 | PYMEM_ALLOCATOR_NOT_SET = 0 | |
| 20 | 21 | PYMEM_ALLOCATOR_DEBUG = 2 | |
@@ -1011,7 +1012,10 @@ def default_program_name(self, config): | |||
| 1011 | 1012 | executable = self.test_exe | |
| 1012 | 1013 | else: | |
| 1013 | 1014 | program_name = 'python3' | |
| 1014 | - executable = shutil.which(program_name) or '' | ||
| 1015 | + if MACOS: | ||
| 1016 | + executable = self.test_exe | ||
| 1017 | + else: | ||
| 1018 | + executable = shutil.which(program_name) or '' | ||
| 1015 | 1019 | config.update({ | |
| 1016 | 1020 | 'program_name': program_name, | |
| 1017 | 1021 | 'base_executable': executable, | |
@@ -1054,13 +1058,8 @@ def test_init_setpath_config(self): | |||
| 1054 | 1058 | 'executable': 'conf_executable', | |
| 1055 | 1059 | } | |
| 1056 | 1060 | env = {'TESTPATH': os.path.pathsep.join(paths)} | |
| 1057 | - # Py_SetPath() preinitialized Python using the compat API, | ||
| 1058 | - # so we need preconfig_api=API_COMPAT. | ||
| 1059 | 1061 | self.check_all_configs("test_init_setpath_config", config, | |
| 1060 | - api=API_PYTHON, | ||
| 1061 | - preconfig_api=API_COMPAT, | ||
| 1062 | - env=env, | ||
| 1063 | - ignore_stderr=True) | ||
| 1062 | + api=API_PYTHON, env=env, ignore_stderr=True) | ||
| 1064 | 1063 | ||
| 1065 | 1064 | def module_search_paths(self, prefix=None, exec_prefix=None): | |
| 1066 | 1065 | config = self._get_expected_config() | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1448,6 +1448,17 @@ static int test_init_setpath(void) | |||
| 1448 | 1448 | ||
| 1449 | 1449 | static int test_init_setpath_config(void) | |
| 1450 | 1450 | { | |
| 1451 | + PyStatus status; | ||
| 1452 | + PyPreConfig preconfig; | ||
| 1453 | + PyPreConfig_InitPythonConfig(&preconfig); | ||
| 1454 | + | ||
| 1455 | + /* Explicitly preinitializes with Python preconfiguration to avoid | ||
| 1456 | + Py_SetPath() implicit preinitialization with compat preconfiguration. */ | ||
| 1457 | + status = Py_PreInitialize(&preconfig); | ||
| 1458 | + if (PyStatus_Exception(status)) { | ||
| 1459 | + Py_ExitStatusException(status); | ||
| 1460 | + } | ||
| 1461 | + | ||
| 1451 | 1462 | char *env = getenv("TESTPATH"); | |
| 1452 | 1463 | if (!env) { | |
| 1453 | 1464 | fprintf(stderr, "missing TESTPATH env var\n"); | |
@@ -1462,7 +1473,6 @@ static int test_init_setpath_config(void) | |||
| 1462 | 1473 | PyMem_RawFree(path); | |
| 1463 | 1474 | putenv("TESTPATH="); | |
| 1464 | 1475 | ||
| 1465 | - PyStatus status; | ||
| 1466 | 1476 | PyConfig config; | |
| 1467 | 1477 | ||
| 1468 | 1478 | status = PyConfig_InitPythonConfig(&config); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments