This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author eryksun
Recipients eryksun, meilyadam, paul.moore, steve.dower, tim.golden, zach.ware
Date 2020-01-24.01:54:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1579830861.59.0.321868019044.issue39439@roundup.psfhosted.org>
In-reply-to
Content
> can you confirm that the fix is to just change spawn.get_executable() 
> to return sys.executable, like it was prior to the PR mentioned in 
> the other ticket?

Yes, in spawn.py, change `_python_exe = sys._base_executable` to `_python_exe = sys.executable`. This is the value that gets returned by spawn.get_executable().

This will restore the operation of the following code in Popen.__init__ in popen_spawn_win32.py:

        python_exe = spawn.get_executable()

        # bpo-35797: When running in a venv, we bypass the redirect
        # executor and launch our base Python.
        if WINENV and _path_eq(python_exe, sys.executable):
            python_exe = sys._base_executable
            env = os.environ.copy()
            env["__PYVENV_LAUNCHER__"] = sys.executable

This code switches to running the base executable in a virtual environment, which is required in order to support duplicating handles to the child or stealing handles from the parent. And the startup code in the child process is made aware of virtual environment via the "__PYVENV_LAUNCHER__" environment variable.
History
Date User Action Args
2020-01-24 01:54:21eryksunsetrecipients: + eryksun, paul.moore, tim.golden, zach.ware, steve.dower, meilyadam
2020-01-24 01:54:21eryksunsetmessageid: <1579830861.59.0.321868019044.issue39439@roundup.psfhosted.org>
2020-01-24 01:54:21eryksunlinkissue39439 messages
2020-01-24 01:54:21eryksuncreate