From 3a0478512f9cd776fb84d27e7892736ff16ad758 Mon Sep 17 00:00:00 2001 From: harjoth Date: Wed, 10 Jun 2026 14:27:10 -0700 Subject: [PATCH 1/2] gh-151096: Fix test_embed with split exec prefix --- Lib/test/test_embed.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Lib/test/test_embed.py b/Lib/test/test_embed.py index 2d1533c46b98f3..d0ac1d1c0cb1a1 100644 --- a/Lib/test/test_embed.py +++ b/Lib/test/test_embed.py @@ -1458,7 +1458,7 @@ def module_search_paths(self, prefix=None, exec_prefix=None): if prefix is None: prefix = config['config']['prefix'] if exec_prefix is None: - exec_prefix = config['config']['prefix'] + exec_prefix = config['config']['exec_prefix'] if MS_WINDOWS: return config['config']['module_search_paths'] else: @@ -1614,8 +1614,10 @@ def test_init_is_python_build_with_home(self): expected_paths[1 if MS_WINDOWS else 2] = os.path.normpath( os.path.join(exedir, f'{f.read()}\n$'.splitlines()[0])) if not MS_WINDOWS: - # PREFIX (default) is set when running in build directory - prefix = exec_prefix = sys.prefix + # PREFIX and EXEC_PREFIX (defaults) are set when running in the + # build directory and may differ with --exec-prefix (gh-151096). + prefix = sys.prefix + exec_prefix = sys.exec_prefix # stdlib calculation (/Lib) is not yet supported expected_paths[0] = self.module_search_paths(prefix=prefix)[0] config.update(prefix=prefix, base_prefix=prefix, From e2c18112f04dbc528343e9d17a9da6e819e9cdd7 Mon Sep 17 00:00:00 2001 From: harjothkhara Date: Mon, 15 Jun 2026 22:11:38 -0700 Subject: [PATCH 2/2] gh-151096: Add Tests NEWS entry for split exec prefix test --- .../next/Tests/2026-06-16-05-11-38.gh-issue-151096.Kq3Lp9.rst | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Misc/NEWS.d/next/Tests/2026-06-16-05-11-38.gh-issue-151096.Kq3Lp9.rst diff --git a/Misc/NEWS.d/next/Tests/2026-06-16-05-11-38.gh-issue-151096.Kq3Lp9.rst b/Misc/NEWS.d/next/Tests/2026-06-16-05-11-38.gh-issue-151096.Kq3Lp9.rst new file mode 100644 index 00000000000000..3251c6fb094723 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2026-06-16-05-11-38.gh-issue-151096.Kq3Lp9.rst @@ -0,0 +1,2 @@ +Fix ``test_embed`` failing when CPython is configured with a split exec prefix +(``--exec-prefix`` differing from ``--prefix``).