summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2017-06-08 16:34:30 (GMT)
committerGitHub <noreply@github.com>2017-06-08 16:34:30 (GMT)
commite5bdad2201de45c203037e59491e4fea56def56d (patch)
tree7a24d825a76eea6def464ecba34bc4324c8c9d28
parentfe681397dc66e2bc7b5baf02cb4f22a1005c6400 (diff)
downloadcpython-e5bdad2201de45c203037e59491e4fea56def56d.zip
cpython-e5bdad2201de45c203037e59491e4fea56def56d.tar.gz
cpython-e5bdad2201de45c203037e59491e4fea56def56d.tar.bz2
bpo-30418: Popen.communicate() always ignore EINVAL (#2002) (#2006)
On Windows, subprocess.Popen.communicate() now also ignore EINVAL on stdin.write() if the child process is still running but closed the pipe. (cherry picked from commit d52aa31378ae43e044a300edfe8285954c167216)
-rw-r--r--Lib/subprocess.py9
-rw-r--r--Misc/NEWS3
2 files changed, 8 insertions, 4 deletions
diff --git a/Lib/subprocess.py b/Lib/subprocess.py
index c6ecc46..4b41f5e 100644
--- a/Lib/subprocess.py
+++ b/Lib/subprocess.py
@@ -720,10 +720,11 @@ class Popen(object):
if e.errno == errno.EPIPE:
# communicate() should ignore broken pipe error
pass
- elif (e.errno == errno.EINVAL
- and self.poll() is not None):
- # Issue #19612: stdin.write() fails with EINVAL
- # if the process already exited before the write
+ elif e.errno == errno.EINVAL:
+ # bpo-19612, bpo-30418: On Windows, stdin.write()
+ # fails with EINVAL if the child process exited or
+ # if the child process is still running but closed
+ # the pipe.
pass
else:
raise
diff --git a/Misc/NEWS b/Misc/NEWS
index 12280bd..914ac89 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -49,6 +49,9 @@ Extension Modules
Library
-------
+- bpo-30418: On Windows, subprocess.Popen.communicate() now also ignore EINVAL
+ on stdin.write() if the child process is still running but closed the pipe.
+
- bpo-30378: Fix the problem that logging.handlers.SysLogHandler cannot
handle IPv6 addresses.