Fixes issue2791: subprocess.Popen.communicate leaked a file descripton until
the last reference to the Popen instance was dropped. Adding explicit
close() calls fixes it.
Candidate for backport to release25-maint.
diff --git a/Lib/subprocess.py b/Lib/subprocess.py
index dc639c9..6065594 100644
--- a/Lib/subprocess.py
+++ b/Lib/subprocess.py
@@ -661,8 +661,10 @@
self.stdin.close()
elif self.stdout:
stdout = self.stdout.read()
+ self.stdout.close()
elif self.stderr:
stderr = self.stderr.read()
+ self.stderr.close()
self.wait()
return (stdout, stderr)