Skip to content
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

pythonw.exe from venv in 3.13 always creates console window #126084

Closed
chrullrich opened this issue Oct 28, 2024 · 0 comments · Fixed by #126088
Closed

pythonw.exe from venv in 3.13 always creates console window #126084

chrullrich opened this issue Oct 28, 2024 · 0 comments · Fixed by #126088
Labels
3.13 bugs and security fixes OS-windows topic-venv Related to the venv module type-bug An unexpected behavior, bug, or error

Comments

@chrullrich
Copy link
Contributor

chrullrich commented Oct 28, 2024

Bug report

Bug description:

In 3.13.0a4 yet another form of launcher executable was added, apparently called "venvlauncher". This latest creation is apparently unaware that pythonw (the GUI subsystem, no-console-window form of interpreter) exists and always runs the regular python.exe (CLI subsystem). Therefore any attempt to run a script in 3.13 will either attach to the current console or create a new, blank console window.

I have not tried building venvlauncher.c with a different definition of EXENAME to see if that works, but since %PROGRAMFILES%\Python313\Lib\venv\scripts\nt\venvwlauncher.exe does not contain the string "pythonw", I'm pretty sure my guess is correct.

There is plenty of infrastructure in the Windows build to make this work, not least this block in venvlauncher.c:

// This should always be defined when we build for real,
// but it's handy to have a definition for quick testing
#ifndef EXENAME
#define EXENAME L"python.exe"
#endif

Someone probably forgot to hook up the external definition in the build.

CPython versions tested on:

3.13

Operating systems tested on:

Windows

Linked PRs

@chrullrich chrullrich added the type-bug An unexpected behavior, bug, or error label Oct 28, 2024
@chrullrich chrullrich changed the title pythonw.exe in 3.13 always creates console window pythonw.exe from venv in 3.13 always creates console window Oct 28, 2024
@picnixz picnixz added OS-windows 3.13 bugs and security fixes topic-venv Related to the venv module labels Oct 28, 2024
chrullrich added a commit to chrullrich/cpython that referenced this issue Oct 28, 2024
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Oct 29, 2024
zooba pushed a commit that referenced this issue Oct 29, 2024
(cherry picked from commit 802d405)

Co-authored-by: Christian Ullrich <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.13 bugs and security fixes OS-windows topic-venv Related to the venv module type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants