Skip to content

Commit a17f160

Browse files
authored
gh-104839: Prevent test_venv AddressSanitizer spam (#105005)
Pass any ASAN_OPTIONS environment variable through to the child process so that leak sanitizer being disabled on our CI and buildbots stays true in the children.
1 parent 46b52e6 commit a17f160

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

Lib/test/test_venv.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -600,15 +600,14 @@ def test_zippath_from_non_installed_posix(self):
600600
ld_library_path_env = "DYLD_LIBRARY_PATH"
601601
else:
602602
ld_library_path_env = "LD_LIBRARY_PATH"
603-
# Note that in address sanitizer mode, the current runtime
604-
# implementation leaks memory due to not being able to correctly
605-
# clean all unicode objects during runtime shutdown. Therefore,
606-
# this uses subprocess.run instead of subprocess.check_call to
607-
# maintain the core of the test while not failing due to the refleaks.
608-
# This should be able to use check_call once all refleaks are fixed.
609-
subprocess.run(cmd,
610-
env={"PYTHONPATH": pythonpath,
611-
ld_library_path_env: ld_library_path})
603+
child_env = {
604+
"PYTHONPATH": pythonpath,
605+
ld_library_path_env: ld_library_path,
606+
}
607+
if asan_options := os.environ.get("ASAN_OPTIONS"):
608+
# prevent https://github.com/python/cpython/issues/104839
609+
child_env["ASAN_OPTIONS"] = asan_options
610+
subprocess.check_call(cmd, env=child_env)
612611
envpy = os.path.join(self.env_dir, self.bindir, self.exe)
613612
# Now check the venv created from the non-installed python has
614613
# correct zip path in pythonpath.

0 commit comments

Comments
 (0)