diff --git a/Lib/test/test_embed.py b/Lib/test/test_embed.py index 16d1c7dea6b4fa..fd474b12a0749a 100644 --- a/Lib/test/test_embed.py +++ b/Lib/test/test_embed.py @@ -96,6 +96,12 @@ def run_embedded_interpreter(self, *args, env=None, env = env.copy() env['SYSTEMROOT'] = os.environ['SYSTEMROOT'] + if env is None and MS_WINDOWS: + if args[0] == "test_repeated_init_exec": + # PYTHONHOME needs to be removed for an executable in + # a build directory to import *.pyd repeatedly. + env = remove_python_envvars() + p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE,