Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Avoid propagating venv settings when launching via py.exe
11 changes: 11 additions & 0 deletions PC/launcher.c
Original file line number Diff line number Diff line change
Expand Up @@ -1707,6 +1707,17 @@ process(int argc, wchar_t ** argv)
command = skip_me(GetCommandLineW());
debug(L"Called with command line: %ls\n", command);

#if !defined(VENV_REDIRECT)
/* bpo-35811: The __PYVENV_LAUNCHER__ variable is used to
* override sys.executable and locate the original prefix path.
* However, if it is silently inherited by a non-venv Python
* process, that process will believe it is running in the venv
* still. This is the only place where *we* can clear it (that is,
* when py.exe is being used to launch Python), so we do.
*/
SetEnvironmentVariableW(L"__PYVENV_LAUNCHER__", NULL);
Comment thread
zooba marked this conversation as resolved.
#endif

#if defined(SCRIPT_WRAPPER)
/* The launcher is being used in "script wrapper" mode.
* There should therefore be a Python script named <exename>-script.py in
Expand Down