Skip to content

Commit 46c5c57

Browse files
authored
GH-145273: skip stdlib warning on module_search_paths_set (#145442)
1 parent 9124bc1 commit 46c5c57

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Modules/getpath.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -773,8 +773,10 @@ def search_up(prefix, *landmarks, test=isfile):
773773
# SANITY CHECKS
774774
# ******************************************************************************
775775

776-
# Warn if the standard library is missing
777-
if not stdlib_zip or not isfile(stdlib_zip):
776+
# Warn if the standard library is missing, unless pythonpath_was_set was set, as
777+
# that skips parts of the stdlib directories calculation — assume the provided
778+
# pythonpath is correct. This is how subinterpreters initialize the path for eg.
779+
if not py_setpath and not pythonpath_was_set and (not stdlib_zip or not isfile(stdlib_zip)):
778780
home_hint = f"The Python 'home' directory was set to {home!r}, is this correct?"
779781
if not stdlib_dir or not isdir(stdlib_dir):
780782
hint = home_hint if home else f'sys.prefix is set to {prefix}, is this correct?'

0 commit comments

Comments
 (0)