This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Segev Finer
Recipients Bernt.Røskar.Brenna, Segev Finer, paul.moore, sbt, steve.dower, tim.golden, vstinner, zach.ware
Date 2017-01-06.12:38:34
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Though Python has taken measures to mark handles as non-inheritable there is still a possible race due to having to create inheritable handles while creating processes with stdio pipes (subprocess).

Attached is a Patch that implements subprocess.Popen(close_fds=True) with stdio handles on Windows using PROC_THREAD_ATTRIBUTE_HANDLE_LIST, which plugs that race completely.

I implemented this by adding the attribute STARTUPINFO._handleList, which when passed to _winapi.CreateProcess, will be passed to CreateProcess as a PROC_THREAD_ATTRIBUTE_HANDLE_LIST. can than use this attribute as needed with inherit_handles=True to only inherit the stdio handles.

The STARTUPINFO._handleList attribute can also be used to implement pass_fds later on. Though the exact behavior of how to convert a file descriptor list to a handle list might be a bit sensitive, so I left that out for now.

This patch obviously doesn't support Windows XP but Python 3 doesn't support XP anymore either.
Date User Action Args
2017-01-06 12:38:36Segev Finersetrecipients: + Segev Finer, paul.moore, vstinner, tim.golden, Bernt.Røskar.Brenna, sbt, zach.ware, steve.dower
2017-01-06 12:38:36Segev Finersetmessageid: <>
2017-01-06 12:38:36Segev Finerlinkissue19764 messages
2017-01-06 12:38:36Segev Finercreate