From 0e31eca7ae393b194b2533ec11eb8194db3eaf2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filipe=20La=C3=ADns?= Date: Mon, 2 Mar 2026 20:24:18 +0000 Subject: [PATCH 1/2] GH-145273: skip stdlib warning on module_search_paths_set MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Filipe Laíns --- Modules/getpath.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Modules/getpath.py b/Modules/getpath.py index 20e050787700bf..06ce9628891551 100644 --- a/Modules/getpath.py +++ b/Modules/getpath.py @@ -773,8 +773,10 @@ def search_up(prefix, *landmarks, test=isfile): # 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 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?' From 2f528386e3c32e88a4dc723e0978e7c21a60ec80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filipe=20La=C3=ADns?= Date: Mon, 2 Mar 2026 20:42:51 +0000 Subject: [PATCH 2/2] Also skip on Py_SetPath MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Filipe Laíns --- Modules/getpath.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/getpath.py b/Modules/getpath.py index 06ce9628891551..2f4d635a29585c 100644 --- a/Modules/getpath.py +++ b/Modules/getpath.py @@ -776,7 +776,7 @@ def search_up(prefix, *landmarks, test=isfile): # 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 pythonpath_was_set and (not stdlib_zip or not isfile(stdlib_zip)): +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?'