Title: Windows: subprocess debug assertion on failure to execute the process
Type: behavior Stage:
Components: Library (Lib), Windows Versions: Python 3.7
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Segev Finer, eryksun, haypo, paul.moore, steve.dower, tim.golden, zach.ware
Priority: normal Keywords:

Created on 2017-04-20 22:43 by Segev Finer, last changed 2017-04-21 16:29 by haypo.

Pull Requests
URL Status Linked Edit
PR 1224 open Segev Finer, 2017-04-20 23:22
Messages (1)
msg292002 - (view) Author: Segev Finer (Segev Finer) * Date: 2017-04-20 22:43
subprocess triggers a debug assertion in the CRT on failure to execute the process due to closing the pipe *handles* in the except clause using os.close rather than .Close() (os.close closes CRT file descriptors and not handles).

In addition to that once this is fixed there is also a double free/close since we need to set `self._closed_child_pipe_fds = True` once we closed the handles in _execute_child so they won't also be closed in __init__.

To reproduce, do this in a debug build of Python:

    import subprocess
    subprocess.Popen('exe_that_doesnt_exist.exe', stdout=subprocess.PIPE)

Date User Action Args
2017-04-21 16:29:11hayposetnosy: + haypo
2017-04-20 23:22:46Segev Finersetpull_requests: + pull_request1346
2017-04-20 22:43:55Segev Finercreate