forked from python/cpython
-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New venv launchers are broken #90
Comments
Thanks for testing. Yes, looks like reverting is the best option at this point. |
Reverted msys2/MINGW-packages#11035 what do you think we should do? Wait for Python 3.11 and then apply this patch there, or try and add support for these venv launchers in current versions? |
Merged
This is fixed by #139 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Got the recent build from staging created the virtual environment with
python3.10
. The venv was created as expected. Then I ran the executablebin/python.exe
and it launched python 3.9 (??). I then set and an env var to debug those launcherPYLAUNCH_DEBUG=1
and ended up with these logsIt launched the
python.exe
instead ofpython3.10.exe
. This is the first broken behaviour I noticed.Then I copied
python3.10.exe
topython.exe
and then recreated that virtual environment. While recreating it ended up running theensurepip
module (the one that bootstraps pip and setuptools) globally and not in the virtual environmentThis is the second broken behaviour I noticed.
Next I ran
bin/python -c 'import sys;print(sys.executable)'
and it ended up printingwhich is again wrong, because it should be printing the virtual environment's executable and not the original one. This is the third broken behaviour I noticed.
Now, the last one made me think that somewhere our python can't detect it's a venv when launched through those launchers, but it could detect it when those executables are copied. I looked into where
sys.executable
is set (it's inModules/getpath.c
) and found that the file is only for UNIX like system and MSVC python usesPC/getpathp.c
which I think is the root cause of the problems (from this comment below).cpython-mingw/Modules/getpath.c
Line 104 in 1a4e816
I think the solutions for these problems requires more work, essentially copying stuff from
PC/getpathp.c
intoModules/getpath.c
for supporting these new launchers. Or maybe usePC/getpathp.c
rather than justModules/getpath.c
, but it still requires work to move patches from the latter. Also, upstream in Python 3.11 ended up changing these C modules to Python python#29041, so the work we would do would be wasted when upgrading to Python 3.11. Not sure what is the best thing to do here.Also, I think those patches from #82 should be reverted until these broken behaviours are fixed.
The text was updated successfully, but these errors were encountered: