Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Doc/library/sys_path_init.rst
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ Please refer to :mod:`site`'s
mechanism, such as :mod:`venv`, that many virtual environment implementations
follow.

.. _sys-path-init-_pth-files:

_pth files
----------

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Avoid warning about missing standard library when using :ref:`sys-path-init-_pth-files`.
8 changes: 4 additions & 4 deletions Modules/getpath.py
Original file line number Diff line number Diff line change
Expand Up @@ -766,10 +766,10 @@ def search_up(prefix, *landmarks, test=isfile):
# SANITY CHECKS
# ******************************************************************************

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