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

set_close_exec implementation for Windows will not work #2866

Closed
zooba opened this issue May 22, 2020 · 1 comment
Closed

set_close_exec implementation for Windows will not work #2866

zooba opened this issue May 22, 2020 · 1 comment

Comments

@zooba
Copy link

zooba commented May 22, 2020

The Windows implementation of set_close_exec https://github.com/tornadoweb/tornado/blob/master/tornado/platform/windows.py currently can never work because SetHandleInformation needs an OS handle, but everywhere this function is called it is given a file descriptor.

Firstly, I believe that by default all handles are non-inheritable. But I haven't checked everywhere you're creating them though - certainly the returned pipes from os.pipe are explicitly noninheritable.

Most likely you should just use os.set_inheritable on all platforms, which does what you need. It was added in Python 3.4, so once 2.7 is no longer a concern this is probably the easiest way forward. It knows how to convert FDs to handles on Windows.

Finally, I came across this because I'm trying to bring up a Python environment on Windows that doesn't include ctypes, and this showed up on my list of "concerns". I'll patch my own to use the builtin function, but figured I'd mention that the current code doesn't work.

@zooba zooba closed this as completed May 22, 2020
@zooba
Copy link
Author

zooba commented May 22, 2020

Dup'd because I resubmitted after github 500'd me. #2867 is still open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant