summaryrefslogtreecommitdiffstats
path: root/Modules/getpath.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2022-05-19 20:13:15 (GMT)
committerGitHub <noreply@github.com>2022-05-19 20:13:15 (GMT)
commit4eb2f407566eac722fb02e610f2327f9f0ed40c4 (patch)
treecd47089535dc810c356a00601210c4ec5ae63d1f /Modules/getpath.py
parent57d7ddd6072ef8996f60ac06d6e2b2484692171b (diff)
downloadcpython-4eb2f407566eac722fb02e610f2327f9f0ed40c4.zip
cpython-4eb2f407566eac722fb02e610f2327f9f0ed40c4.tar.gz
cpython-4eb2f407566eac722fb02e610f2327f9f0ed40c4.tar.bz2
gh-92913: Clarify changes to PyInitConfig.module_search_paths[_set] fields (GH-92980)
(cherry picked from commit 403d16fa28764718dcd0536ccb3ab8d05768465d) Co-authored-by: Steve Dower <steve.dower@python.org>
Diffstat (limited to 'Modules/getpath.py')
-rw-r--r--Modules/getpath.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/Modules/getpath.py b/Modules/getpath.py
index 9aff19c..47f075c 100644
--- a/Modules/getpath.py
+++ b/Modules/getpath.py
@@ -228,6 +228,7 @@ ENV_PYTHONPATH = config['pythonpath_env']
use_environment = config.get('use_environment', 1)
pythonpath = config.get('module_search_paths')
+pythonpath_was_set = config.get('module_search_paths_set')
real_executable_dir = None
stdlib_dir = None
@@ -626,8 +627,8 @@ if py_setpath:
config['module_search_paths'] = py_setpath.split(DELIM)
config['module_search_paths_set'] = 1
-elif not pythonpath:
- # If pythonpath was already set, we leave it alone.
+elif not pythonpath_was_set:
+ # If pythonpath was already explicitly set or calculated, we leave it alone.
# This won't matter in normal use, but if an embedded host is trying to
# recalculate paths while running then we do not want to change it.
pythonpath = []