summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-02-18 21:06:35 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2014-02-18 21:06:35 (GMT)
commit5f47ac2aaab2a4f23897a680ed264e0ae2032b1c (patch)
tree060990d9ae7edfeb79584e9c5373c19f6859201b
parent9a0cbcc4f8f6b61086629907767cd6f3d5ffe8f5 (diff)
parentd5c8ce7cc03d81402b2fcdc023fb6ea44ac70f25 (diff)
downloadcpython-5f47ac2aaab2a4f23897a680ed264e0ae2032b1c.zip
cpython-5f47ac2aaab2a4f23897a680ed264e0ae2032b1c.tar.gz
cpython-5f47ac2aaab2a4f23897a680ed264e0ae2032b1c.tar.bz2
(Merge 3.3) Issue #19612: On Windows, subprocess.Popen.communicate() now
ignores OSError(22, 'Invalid argument') when writing input data into stdin, whereas the process already exited.
-rw-r--r--Lib/subprocess.py10
-rw-r--r--Misc/NEWS4
2 files changed, 13 insertions, 1 deletions
diff --git a/Lib/subprocess.py b/Lib/subprocess.py
index f47f5ab..921670d 100644
--- a/Lib/subprocess.py
+++ b/Lib/subprocess.py
@@ -1186,7 +1186,15 @@ class Popen(object):
try:
self.stdin.write(input)
except OSError as e:
- if e.errno != errno.EPIPE:
+ if e.errno == errno.EPIPE:
+ # communicate() should ignore pipe full 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
+ pass
+ else:
raise
self.stdin.close()
diff --git a/Misc/NEWS b/Misc/NEWS
index caad096..42ab220 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -28,6 +28,10 @@ Core and Builtins
Library
-------
+- Issue #19612: On Windows, subprocess.Popen.communicate() now ignores
+ OSError(22, 'Invalid argument') when writing input data into stdin, whereas
+ the process already exited.
+
- Issue #20320: select.select() and select.kqueue.control() now round the
timeout aways from zero, instead of rounding towards zero.