Skip to content

Commit 352aada

Browse files
[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 b19839b) Co-authored-by: Harjoth Khara <harjoth.khara@gmail.com>
1 parent 527e238 commit 352aada

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

Lib/test/test_embed.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1417,7 +1417,7 @@ def module_search_paths(self, prefix=None, exec_prefix=None):
14171417
if prefix is None:
14181418
prefix = config['config']['prefix']
14191419
if exec_prefix is None:
1420-
exec_prefix = config['config']['prefix']
1420+
exec_prefix = config['config']['exec_prefix']
14211421
if MS_WINDOWS:
14221422
return config['config']['module_search_paths']
14231423
else:
@@ -1551,8 +1551,10 @@ def test_init_is_python_build_with_home(self):
15511551
expected_paths[1 if MS_WINDOWS else 2] = os.path.normpath(
15521552
os.path.join(exedir, f'{f.read()}\n$'.splitlines()[0]))
15531553
if not MS_WINDOWS:
1554-
# PREFIX (default) is set when running in build directory
1555-
prefix = exec_prefix = sys.prefix
1554+
# PREFIX and EXEC_PREFIX (defaults) are set when running in the
1555+
# build directory and may differ with --exec-prefix (gh-151096).
1556+
prefix = sys.prefix
1557+
exec_prefix = sys.exec_prefix
15561558
# stdlib calculation (/Lib) is not yet supported
15571559
expected_paths[0] = self.module_search_paths(prefix=prefix)[0]
15581560
config.update(prefix=prefix, base_prefix=prefix,
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix ``test_embed`` failing when CPython is configured with a split exec prefix
2+
(``--exec-prefix`` differing from ``--prefix``).

0 commit comments

Comments
 (0)