summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>2009-06-18 22:32:50 (GMT)
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>2009-06-18 22:32:50 (GMT)
commit5fe420e34c0827902cd237f9225b25f446288e47 (patch)
tree3811da1c2dd7299ce1a034d3a14fa1936cedcce7
parentc29863e3a6d3fe076eac4ef42c827ecc38ccc4b1 (diff)
downloadcpython-5fe420e34c0827902cd237f9225b25f446288e47.zip
cpython-5fe420e34c0827902cd237f9225b25f446288e47.tar.gz
cpython-5fe420e34c0827902cd237f9225b25f446288e47.tar.bz2
#6189: The subprocess.py module should be kept compatible with python 2.2
(On windows, you still have to change one line to use pywin32 instead of the _subprocess helper module)
-rw-r--r--Lib/subprocess.py15
-rw-r--r--Misc/NEWS2
2 files changed, 14 insertions, 3 deletions
diff --git a/Lib/subprocess.py b/Lib/subprocess.py
index 27f4efc..58d6c0c 100644
--- a/Lib/subprocess.py
+++ b/Lib/subprocess.py
@@ -500,7 +500,7 @@ def check_output(*popenargs, **kwargs):
"""
if 'stdout' in kwargs:
raise ValueError('stdout argument not allowed, it will be overridden.')
- process = Popen(*popenargs, stdout=PIPE, **kwargs)
+ process = Popen(stdout=PIPE, *popenargs, **kwargs)
output, unused_err = process.communicate()
retcode = process.poll()
if retcode:
@@ -1020,8 +1020,17 @@ class Popen(object):
def _close_fds(self, but):
- os.closerange(3, but)
- os.closerange(but + 1, MAXFD)
+ if hasattr(os, 'closerange'):
+ os.closerange(3, but)
+ os.closerange(but + 1, MAXFD)
+ else:
+ for i in xrange(3, MAXFD):
+ if i == but:
+ continue
+ try:
+ os.close(i)
+ except:
+ pass
def _execute_child(self, args, executable, preexec_fn, close_fds,
diff --git a/Misc/NEWS b/Misc/NEWS
index ab00d38..839d819 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -327,6 +327,8 @@ Core and Builtins
Library
-------
+- Issue #6189: Restored compatibility of subprocess.py with Python 2.2.
+
- Issue #6287: Added the license field in Distutils documentation.
- Issue #6286: Now Distutils upload command is based on urllib2 instead of