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

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


http://hg.python.org/cpython/rev/83013a7be836
changeset: 89259:83013a7be836
branch: 3.3
parent: 89254:d610a2740b5f
user: Victor Stinner <victor.stinner at gmail.com>
date: Tue Feb 18 22:00:53 2014 +0100
summary:
 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 | 6 +++++-
 2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/Lib/subprocess.py b/Lib/subprocess.py
--- a/Lib/subprocess.py
+++ b/Lib/subprocess.py
@@ -1193,7 +1193,15 @@
 try:
 self.stdin.write(input)
 except IOError as e:
- if e.errno != errno.EPIPE:
+ if e.errno == errno.EPIPE:
+ # 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
@@ -20,6 +20,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 #6815: os.path.expandvars() now supports non-ASCII environment
 variables names and values.
 
@@ -27,7 +31,7 @@
 Based on patch by Stephen Tu.
 
 - Issue #8478: Untokenizer.compat processes first token from iterator input.
- Patch based on lines from Georg Brandl, Eric Snow, and Gareth Rees. 
+ Patch based on lines from Georg Brandl, Eric Snow, and Gareth Rees.
 
 - Issue #20594: Avoid name clash with the libc function posix_close.
 
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

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