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 eryksun
Recipients docs@python, eryksun, jwilk, paul.moore, steve.dower, techtonik, terry.reedy, tim.golden, zach.ware
Date 2021-03-30.18:18:06
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1617128286.77.0.208583507969.issue19124@roundup.psfhosted.org>
In-reply-to
Content
> Even if that's just swapping the execv call for spawnv(_P_WAIT) 
> and then exiting, that's fine by me

Maybe call SuspendThread() on other threads, at least the ones that can be enumerated with the threading module.

> I don't see how its behaviour would change at all, unless we're going
> well out of our way to override the CRT. Which I wouldn't want to see 
> us do.

The suggestion was for Python to implement system() and spawnv[e]() using subprocess or _winapi. That would eliminate the problem of leaked handles when subprocess.Popen() is called concurrently with os.system() and os.spawn*(). However, inheritance of file descriptors cannot be reasonably implemented in that case, not without accessing private CRT data (i.e. the internal flags of each file descriptor). 

If os.spawn*() has to continue supporting inheritance of file descriptors, then the idea is probably a non-starter. All we can do is hope that the CRT's common spawn code will eventually use PROC_THREAD_ATTRIBUTE_HANDLE_LIST. This feature only protects against leaked handles (particularly important for pipes) if it's used by all concurrent CreateProcessW() calls that inherit handles.
History
Date User Action Args
2021-03-30 18:18:06eryksunsetrecipients: + eryksun, terry.reedy, paul.moore, techtonik, tim.golden, jwilk, docs@python, zach.ware, steve.dower
2021-03-30 18:18:06eryksunsetmessageid: <1617128286.77.0.208583507969.issue19124@roundup.psfhosted.org>
2021-03-30 18:18:06eryksunlinkissue19124 messages
2021-03-30 18:18:06eryksuncreate