gh-92913: Clarify changes to PyInitConfig.module_search_paths[_set] fields (GH-92980)

This commit is contained in:
Steve Dower 2022-05-19 20:23:53 +01:00 committed by GitHub
parent 3fd8610002
commit 403d16fa28
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 39 additions and 8 deletions

View file

@ -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 = []