Skip to content

Commit 448612b

Browse files
committed
fix missing LD_* vars
1 parent 2a8a5a2 commit 448612b

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Lib/test/test_os/test_os.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2654,9 +2654,13 @@ def values(self): return VALUES
26542654
os.execve(args[0], args, MyEnv())
26552655
""".format(unix_shell=unix_shell, message=message)
26562656

2657-
# Use '__cleanenv' to signal to assert_python_ok() not
2658-
# to do a copy of os.environ on its own.
2659-
rc, out, _ = assert_python_ok('-c', code, __cleanenv=True)
2657+
# Make sure to forward "LD_*" variables so that assert_python_ok()
2658+
# can run correctly.
2659+
minimal = {k: v for k, v in os.environ.items() if k.startswith("LD_")}
2660+
with os_helper.EnvironmentVarGuard() as env:
2661+
env.clear()
2662+
env.update(minimal)
2663+
rc, out, _ = assert_python_ok('-c', code, **env)
26602664
self.assertEqual(rc, 0)
26612665
self.assertIn(bytes(message, "ascii"), out)
26622666

0 commit comments

Comments
 (0)