-
-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
os.dup() creates an inheritable fd when handling a character file on Windows #81448
Comments
In PR 13739, Eryk Sun mentioned that the Windows implementation of os.dup() returns an inheritable fd when handling a character file. A comment in _Py_dup() makes it seem as though this is due to a belief that handles for character files cannot be made non-inheritable (which is wrong). |
If you care of inherited handles on Windows, please have a look at:
ref: https://pythondev.readthedocs.io/unstable_tests.html#windows-handles I decided to give up because of multiprocessing race conditions. I failed to fix them. |
According to the discussion in PR 14051: if os.dup() fails to make the new file descriptor new inheritable for a character device, the error must not be ignored. Instead, the caller is supposed to use os.dup(fd, inheritable=False). Before *this bugfix*, os.dup() didn't respect its contract: fd2 was inheritable sometimes. Now the caller is aware of such special case and so can handle it properly. |
Thanks Zackery Spytz as usual! |
This may have caused a regression, see bpo-37549. |
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: