Title: subprocess.communicate() doesn't close pipes on Windows
Type: Stage:
Components: Library (Lib), Windows Versions: Python 3.2
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: amaury.forgeotdarc, gps, pitrou, vstinner
Priority: normal Keywords: patch

Created on 2010-12-23 11:59 by vstinner, last changed 2010-12-25 22:43 by vstinner. This issue is now closed.

File name Uploaded Description Edit
subprocess_close_pipes.patch vstinner, 2010-12-23 11:59
Messages (2)
msg124547 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2010-12-23 11:59
If more than one file (stdin, stdout and stderr) are pipes, Popen.communicate() uses threads calling _readerthread() on each pipe. But this method doesn't close the pipes, whereas all other communicate implementations (select, poll and the optimization if there is only one pipe) do close all pipes.

Attached patch fixes this issue.

Thanks Antoine for your nice ResourceWarning patch!
msg124649 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2010-12-25 22:43
Fixed by r87485 (Python 3.2).

I don't want to fix it in 2.7 or 3.1, because maybe someone relies on this bug and it's a minor bug :-) Reopen the issue if you would like a backport.
Date User Action Args
2010-12-25 22:43:41vstinnersetstatus: open -> closed

messages: + msg124649
resolution: fixed
nosy: amaury.forgeotdarc, pitrou, vstinner, gps
2010-12-24 10:17:17pitrousetnosy: + gps
2010-12-23 11:59:52vstinnersetnosy: + amaury.forgeotdarc, pitrou
2010-12-23 11:59:26vstinnercreate