]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
GH-145273: skip stdlib warning on module_search_paths_set (#145442)
authorFilipe Laíns <lains@riseup.net>
Mon, 2 Mar 2026 21:11:27 +0000 (21:11 +0000)
committerGitHub <noreply@github.com>
Mon, 2 Mar 2026 21:11:27 +0000 (21:11 +0000)
Modules/getpath.py

index 20e050787700bf832761c66c04ee28a45da9938e..2f4d635a29585c2e69a21e5ce313d4510d0c35e2 100644 (file)
@@ -773,8 +773,10 @@ elif not pythonpath_was_set:
 # SANITY CHECKS
 # ******************************************************************************
 
-# Warn if the standard library is missing
-if not stdlib_zip or not isfile(stdlib_zip):
+# 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 and (not stdlib_zip or not isfile(stdlib_zip)):
     home_hint = f"The Python 'home' directory was set to {home!r}, is this correct?"
     if not stdlib_dir or not isdir(stdlib_dir):
         hint = home_hint if home else f'sys.prefix is set to {prefix}, is this correct?'