Skip to content

Commit 7936337

Browse files
committed
gh-155254: Avoid warning about missing stdlib when using _pth files
1 parent 66d7c89 commit 7936337

3 files changed

Lines changed: 4 additions & 1 deletion

File tree

Doc/library/sys_path_init.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ Please refer to :mod:`site`'s
105105
mechanism, such as :mod:`venv`, that many virtual environment implementations
106106
follow.
107107

108+
.. _sys-path-init-_pth-files:
109+
108110
_pth files
109111
----------
110112

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Avoid warning about missing standard library when using :ref:`sys-path-init-_pth-files`.

Modules/getpath.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,7 @@ def search_up(prefix, *landmarks, test=isfile):
769769
# Warn if the standard library is missing, unless pythonpath_was_set was set, as
770770
# that skips parts of the stdlib directories calculation — assume the provided
771771
# pythonpath is correct. This is how subinterpreters initialize the path for eg.
772-
if not py_setpath and not pythonpath_was_set:
772+
if not py_setpath and not pythonpath_was_set and not 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)