Skip to content

Commit 191e278

Browse files
committed
Clarify comment and logic
1 parent 7936337 commit 191e278

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

Modules/getpath.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -766,10 +766,10 @@ def search_up(prefix, *landmarks, test=isfile):
766766
# SANITY CHECKS
767767
# ******************************************************************************
768768

769-
# Warn if the standard library is missing, unless pythonpath_was_set was set, as
770-
# that skips parts of the stdlib directories calculation — assume the provided
771-
# pythonpath is correct. This is how subinterpreters initialize the path for eg.
772-
if not py_setpath and not pythonpath_was_set and not pth:
769+
# Warn if we did a search for the standard library and couldn't find it. Never
770+
# show a warning if paths were provided explicitly, since we trust the caller
771+
# knows what they're doing even if the layout doesn't look "normal".
772+
if not (py_setpath or pythonpath_was_set or pth):
773773
home_hint = f"The Python 'home' directory was set to {home!r}, is this correct?"
774774
if (not stdlib_zip or not isfile(stdlib_zip)) and (not stdlib_dir or not isdir(stdlib_dir)):
775775
hint = home_hint if home else f'sys.prefix is set to {prefix}, is this correct?'

0 commit comments

Comments
 (0)