Skip to content

Commit f4c2316

Browse files
[3.15] gh-151096: Fix test_embed with split exec prefix (GH-151288) (#152590)
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 bbc7e9b commit f4c2316

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
@@ -1429,7 +1429,7 @@ def module_search_paths(self, prefix=None, exec_prefix=None):
14291429
if prefix is None:
14301430
prefix = config['config']['prefix']
14311431
if exec_prefix is None:
1432-
exec_prefix = config['config']['prefix']
1432+
exec_prefix = config['config']['exec_prefix']
14331433
if MS_WINDOWS:
14341434
return config['config']['module_search_paths']
14351435
else:
@@ -1578,8 +1578,10 @@ def test_init_is_python_build_with_home(self):
15781578
expected_paths[1 if MS_WINDOWS else 2] = os.path.normpath(
15791579
os.path.join(exedir, f'{f.read()}\n$'.splitlines()[0]))
15801580
if not MS_WINDOWS:
1581-
# PREFIX (default) is set when running in build directory
1582-
prefix = exec_prefix = sys.prefix
1581+
# PREFIX and EXEC_PREFIX (defaults) are set when running in the
1582+
# build directory and may differ with --exec-prefix (gh-151096).
1583+
prefix = sys.prefix
1584+
exec_prefix = sys.exec_prefix
15831585
# stdlib calculation (/Lib) is not yet supported
15841586
expected_paths[0] = self.module_search_paths(prefix=prefix)[0]
15851587
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)