https://github.com/python/cpython/commit/352aada0385f46326684b271ed918c51786816ab commit: 352aada0385f46326684b271ed918c51786816ab branch: 3.14 author: Miss Islington (bot) <[email protected]> committer: vstinner <[email protected]> date: 2026-06-29T13:59:27Z summary:
[3.14] gh-151096: Fix test_embed with split exec prefix (GH-151288) (#152591) gh-151096: Fix test_embed with split exec prefix (GH-151288) (cherry picked from commit b19839b40c771904b87ea35127f9fa1b8058597e) Co-authored-by: Harjoth Khara <[email protected]> files: A Misc/NEWS.d/next/Tests/2026-06-16-05-11-38.gh-issue-151096.Kq3Lp9.rst M Lib/test/test_embed.py diff --git a/Lib/test/test_embed.py b/Lib/test/test_embed.py index a4a328aa3dde244..7e5ab19d4134fc1 100644 --- a/Lib/test/test_embed.py +++ b/Lib/test/test_embed.py @@ -1417,7 +1417,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: @@ -1551,8 +1551,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, 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 000000000000000..3251c6fb094723b --- /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``). _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: [email protected]
