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 meilyadam
Recipients meilyadam, paul.moore, steve.dower, tim.golden, zach.ware
Date 2020-01-23.21:04:49
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1579813490.23.0.271185160871.issue39439@roundup.psfhosted.org>
In-reply-to
Content
I upgraded from Python 3.7.1 to 3.7.6 and began noticing a behavior that was breaking my code. My code detects if it's running in a virtualenv. This check worked in 3.7.1 but is broken in 3.7.6.

From the documentation, sys.prefix and sys.exec_prefix should point to the virtualenv when one is active. However, I'm seeing that both of these constants are pointing to the system installation directory and not my virtualenv when I am in a multiprocessing child. Here is an example output of a test application running in 3.7.6 (I've attached the test script to this ticket):

Parent process
=============================================
sys.prefix:           C:\Users\user\project\venv
sys.exec_prefix:      C:\Users\user\project\venv
sys.base_prefix:      C:\Program Files\Python37
sys.base_exec_prefix: C:\Program Files\Python37
=============================================

Subprocess
=============================================
sys.prefix:           C:\Program Files\Python37
sys.exec_prefix:      C:\Program Files\Python37
sys.base_prefix:      C:\Program Files\Python37
sys.base_exec_prefix: C:\Program Files\Python37
=============================================


I would expect that sys.prefix and sys.exec_prefix to be identical in the parent and child process.

I verified that this behavior is present in 3.7.5, 3.7.6, and 3.8.1. I am on a Windows 10 x64 system.

Python 3.8.1 (tags/v3.8.1:1b293b6, Dec 18 2019, 23:11:46) [MSC v.1916 64 bit (AMD64)] on win32
History
Date User Action Args
2020-01-23 21:04:50meilyadamsetrecipients: + meilyadam, paul.moore, tim.golden, zach.ware, steve.dower
2020-01-23 21:04:50meilyadamsetmessageid: <1579813490.23.0.271185160871.issue39439@roundup.psfhosted.org>
2020-01-23 21:04:50meilyadamlinkissue39439 messages
2020-01-23 21:04:49meilyadamcreate