summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2012-12-26 12:10:19 -0500
committerJason R. Coombs <jaraco@jaraco.com>2012-12-26 12:10:19 -0500
commitf3eb7cbde7c89a2f279e92a1502c20bf89d8b0b1 (patch)
tree5d06288a85f9fe393e15ad41ea2824c5d2eebdfa
parent68321e3219d6a5a0ee1a3951cba25b208f82da82 (diff)
downloadcherrypy-f3eb7cbde7c89a2f279e92a1502c20bf89d8b0b1.tar.gz
Fixed several more syntax errors on Python 2.3. The module no compiles under Python 2.3.
-rw-r--r--cherrypy/_cpcompat_subprocess.py31
1 files changed, 16 insertions, 15 deletions
diff --git a/cherrypy/_cpcompat_subprocess.py b/cherrypy/_cpcompat_subprocess.py
index 5fd61a4c..c48fc677 100644
--- a/cherrypy/_cpcompat_subprocess.py
+++ b/cherrypy/_cpcompat_subprocess.py
@@ -476,7 +476,7 @@ def _eintr_retry_call(func, *args):
while True:
try:
return func(*args)
- except (OSError, IOError) as e:
+ except (OSError, IOError), e:
if e.errno == errno.EINTR:
continue
raise
@@ -738,7 +738,7 @@ class Popen(object):
if input:
try:
self.stdin.write(input)
- except IOError as e:
+ except IOError, e:
if e.errno != errno.EPIPE and e.errno != errno.EINVAL:
raise
self.stdin.close()
@@ -886,7 +886,8 @@ class Popen(object):
# Start the process
try:
- hp, ht, pid, tid = _subprocess.CreateProcess(executable, args,
+ try:
+ hp, ht, pid, tid = _subprocess.CreateProcess(executable, args,
# no special security
None, None,
int(not close_fds),
@@ -894,12 +895,12 @@ class Popen(object):
env,
cwd,
startupinfo)
- except pywintypes.error, e:
- # Translate pywintypes.error to WindowsError, which is
- # a subclass of OSError. FIXME: We should really
- # translate errno using _sys_errlist (or similar), but
- # how can this be done from Python?
- raise WindowsError(*e.args)
+ except pywintypes.error, e:
+ # Translate pywintypes.error to WindowsError, which is
+ # a subclass of OSError. FIXME: We should really
+ # translate errno using _sys_errlist (or similar), but
+ # how can this be done from Python?
+ raise WindowsError(*e.args)
finally:
# Child is launched. Close the parent's copy of those pipe
# handles that only the child should have open. You need
@@ -972,7 +973,7 @@ class Popen(object):
if input is not None:
try:
self.stdin.write(input)
- except IOError as e:
+ except IOError, e:
if e.errno != errno.EPIPE:
raise
self.stdin.close()
@@ -1181,7 +1182,7 @@ class Popen(object):
# Close pipe fds. Make sure we don't close the
# same fd more than once, or standard fds.
- closed = { None }
+ closed = set([None])
for fd in [p2cread, c2pwrite, errwrite]:
if fd not in closed and fd > 2:
os.close(fd)
@@ -1239,7 +1240,7 @@ class Popen(object):
if data != "":
try:
_eintr_retry_call(os.waitpid, self.pid, 0)
- except OSError as e:
+ except OSError, e:
if e.errno != errno.ECHILD:
raise
child_exception = pickle.loads(data)
@@ -1289,7 +1290,7 @@ class Popen(object):
if self.returncode is None:
try:
pid, sts = _eintr_retry_call(os.waitpid, self.pid, 0)
- except OSError as e:
+ except OSError, e:
if e.errno != errno.ECHILD:
raise
# This happens if SIGCLD is set to be ignored or waiting
@@ -1374,7 +1375,7 @@ class Popen(object):
chunk = input[input_offset : input_offset + _PIPE_BUF]
try:
input_offset += os.write(fd, chunk)
- except OSError as e:
+ except OSError, e:
if e.errno == errno.EPIPE:
close_unregister_and_remove(fd)
else:
@@ -1422,7 +1423,7 @@ class Popen(object):
chunk = input[input_offset : input_offset + _PIPE_BUF]
try:
bytes_written = os.write(self.stdin.fileno(), chunk)
- except OSError as e:
+ except OSError, e:
if e.errno == errno.EPIPE:
self.stdin.close()
write_set.remove(self.stdin)