-
-
Notifications
You must be signed in to change notification settings - Fork 32k
test_os fails on Windows if current directory contains spaces #75729
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
Comments
I just have built Python on Windows first time and ran tests. test_os fails because the current directory path contains spaces. test_spawnl (test.test_os.SpawnTests) ... C:\Users\Serhiy: can't open file 'Storchaka\py\cpython\PCBuild\win32\python.exe': [Errno 2] No such file or directory |
Just ran into this issue myself building on Windows—all of the tests under Maybe it would also be a good idea to document this limitation/OS-specific difference, so that users are aware of it? And perhaps even resolve this platform-specific discrepancy for 3.12+ (but I'm assuming that's non-trivial, or it would have been done before)? |
It is really very bad API design on Windows. It is a documented quirk, but it is still unsafe and unconvenient.
We now have two options:
We can also deprecate these functions on Windows or on all platforms. I would say that deprecating broken by design function is a right thing, but now we have correct and predicable implementation on Posix platforms. I think it requires a wider discussion. |
Thanks for the detailed insight!
Just to note,
Sure. Would you like me to post a thread about it in the Core Development category on the Python Discourse? Here's a summary of the possible approaches, as well as current usage: PreliminariesEither fixing it or deprecating it will presumably have to be 3.12 only regardless, whereas fixing the docs and tests can and should be backported to bugfix versions, so at minimum, we should:
Option 1: FixTo confirm, is the correct argument pre-processing behavior (whether implemented on the user side or in the stdlib itself) basically what the undocumented subprocess.list2cmdline does for Option 2: DeprecateOf course, that assumes there's a reason to keep these legacy functions around, instead of just deprecating them in favor of Option 3: Work aroundThere is a third alternative—document Survey of current usageFWIW, there are 438 hits for
TL;DR:
Its also used 2 other places in the stdlib tests, once in a test of ConclusionTherefore, it seems reasonable to either fix this issue in 3.12, helping the small number of downstream uses this would adversely affect (those already naively quoting their args) either adapt to the change or migrate to |
Definitely! Please do this. You wrote a great summary, I would never write something similar. |
No, you wrote a great summary, I wrote a long wordy essay, and you're smart to not spend your valuable time writing something similar, as opposed to actually getting things done working on Python :) |
To note, I've confirmed the These see over 10x or more unique usage, with 2,338 hits on grep.app for |
I expect any Windows's implementation ought to be the equivalent of A big warning in the docs that this is not a portable function, and behaviour could subtly or drastically vary between OSs, seems sufficient for me. I'm pretty sure we already point at (This isn't the first time I've wanted either a warning or a linter for "potentially non-portable code". Something a dev opts into for any function known to work differently on other platforms when we have a more reliable alternative. This would, of course, report all uses of |
* Quote paths in os.spawn tests on Windows so they work with spaces * Add NEWS entry for os spawn test fix * Fix code style to avoid double negative in os.spawn tests Co-authored-by: Jelle Zijlstra <[email protected]> --------- Co-authored-by: Jelle Zijlstra <[email protected]>
…thonGH-99150) * Quote paths in os.spawn tests on Windows so they work with spaces * Add NEWS entry for os spawn test fix * Fix code style to avoid double negative in os.spawn tests Co-authored-by: Jelle Zijlstra <[email protected]> --------- (cherry picked from commit a34c796) Co-authored-by: C.A.M. Gerlach <[email protected]> Co-authored-by: Jelle Zijlstra <[email protected]>
* Quote paths in os.spawn tests on Windows so they work with spaces * Add NEWS entry for os spawn test fix * Fix code style to avoid double negative in os.spawn tests Co-authored-by: Jelle Zijlstra <[email protected]> --------- (cherry picked from commit a34c796) Co-authored-by: C.A.M. Gerlach <[email protected]> Co-authored-by: Jelle Zijlstra <[email protected]>
…thon#99150) * Quote paths in os.spawn tests on Windows so they work with spaces * Add NEWS entry for os spawn test fix * Fix code style to avoid double negative in os.spawn tests Co-authored-by: Jelle Zijlstra <[email protected]> --------- Co-authored-by: Jelle Zijlstra <[email protected]>
Uh oh!
There was an error while loading. Please reload this page.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: