From 5d6e463df4c44d2601f88b6bb01f15384c9d0ff8 Mon Sep 17 00:00:00 2001 From: Ian Norton Date: Wed, 19 May 2021 10:37:17 +0100 Subject: [PATCH] bpo-43749: Ensure current exe is copied when using venv on windows (GH-25216) Automerge-Triggered-By: GH:vsajip --- Lib/venv/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Lib/venv/__init__.py b/Lib/venv/__init__.py index 8009deb3ea7..b007e25f7ea 100644 --- a/Lib/venv/__init__.py +++ b/Lib/venv/__init__.py @@ -267,8 +267,9 @@ class EnvBuilder: os.path.normcase(f).startswith(('python', 'vcruntime')) ] else: - suffixes = ['python.exe', 'python_d.exe', 'pythonw.exe', - 'pythonw_d.exe'] + suffixes = {'python.exe', 'python_d.exe', 'pythonw.exe', 'pythonw_d.exe'} + base_exe = os.path.basename(context.env_exe) + suffixes.add(base_exe) for suffix in suffixes: src = os.path.join(dirname, suffix)