[Python-checkins] cpython (merge 3.3 -> default): (Merge 3.3) Issue #19612: On Windows, subprocess.Popen.communicate() now

victor.stinner python-checkins at python.org
Tue Feb 18 22:08:16 CET 2014


http://hg.python.org/cpython/rev/423cb79640eb
changeset: 89260:423cb79640eb
parent: 89258:587fd4b91120
parent: 89259:83013a7be836
user: Victor Stinner <victor.stinner at gmail.com>
date: Tue Feb 18 22:06:35 2014 +0100
summary:
 (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.
files:
 Lib/subprocess.py | 10 +++++++++-
 Misc/NEWS | 4 ++++
 2 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/Lib/subprocess.py b/Lib/subprocess.py
--- a/Lib/subprocess.py
+++ b/Lib/subprocess.py
@@ -1186,7 +1186,15 @@
 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
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -28,6 +28,10 @@
 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.
 
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /