From e267793aa4101b2771ed0e66aaff5743d23f59af Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Sat, 21 Sep 2019 01:50:16 +0200 Subject: bpo-38234: Fix PyConfig_Read() when Py_SetPath() was called (GH-16298) * If Py_SetPath() has been called, _PyConfig_InitPathConfig() now uses its value. * Py_Initialize() now longer copies path configuration from PyConfig to the global path configuration (_Py_path_config). --- Modules/getpath.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'Modules/getpath.c') diff --git a/Modules/getpath.c b/Modules/getpath.c index 36f9860ea1..3946623862 100644 --- a/Modules/getpath.c +++ b/Modules/getpath.c @@ -1213,10 +1213,12 @@ calculate_path_impl(const PyConfig *config, "Consider setting $PYTHONHOME to [:]\n"); } - status = calculate_module_search_path(config, calculate, - prefix, exec_prefix, pathconfig); - if (_PyStatus_EXCEPTION(status)) { - return status; + if (pathconfig->module_search_path == NULL) { + status = calculate_module_search_path(config, calculate, + prefix, exec_prefix, pathconfig); + if (_PyStatus_EXCEPTION(status)) { + return status; + } } status = calculate_reduce_prefix(calculate, prefix, Py_ARRAY_LENGTH(prefix)); -- cgit v1.2.1