Commit a8173283 authored by Gregory P. Smith's avatar Gregory P. Smith

Undo an unnecessary else: and indentation that r60104 added.

try:
  ...
except:
  ...
  raise
else:
  ...

the else: is unecessary due to the blind except: with a raise.
parent 3d9ae06e
...@@ -1005,64 +1005,63 @@ class Popen(object): ...@@ -1005,64 +1005,63 @@ class Popen(object):
if gc_was_enabled: if gc_was_enabled:
gc.enable() gc.enable()
raise raise
else: self._child_created = True
self._child_created = True if self.pid == 0:
if self.pid == 0: # Child
# Child try:
try: # Close parent's pipe ends
# Close parent's pipe ends if p2cwrite is not None:
if p2cwrite is not None: os.close(p2cwrite)
os.close(p2cwrite) if c2pread is not None:
if c2pread is not None: os.close(c2pread)
os.close(c2pread) if errread is not None:
if errread is not None: os.close(errread)
os.close(errread) os.close(errpipe_read)
os.close(errpipe_read)
# Dup fds for child
# Dup fds for child if p2cread is not None:
if p2cread is not None: os.dup2(p2cread, 0)
os.dup2(p2cread, 0) if c2pwrite is not None:
if c2pwrite is not None: os.dup2(c2pwrite, 1)
os.dup2(c2pwrite, 1) if errwrite is not None:
if errwrite is not None: os.dup2(errwrite, 2)
os.dup2(errwrite, 2)
# Close pipe fds. Make sure we don't close the same
# Close pipe fds. Make sure we don't close the same # fd more than once, or standard fds.
# fd more than once, or standard fds. if p2cread is not None and p2cread not in (0,):
if p2cread is not None and p2cread not in (0,): os.close(p2cread)
os.close(p2cread) if c2pwrite is not None and c2pwrite not in (p2cread, 1):
if c2pwrite is not None and c2pwrite not in (p2cread, 1): os.close(c2pwrite)
os.close(c2pwrite) if errwrite is not None and errwrite not in (p2cread, c2pwrite, 2):
if errwrite is not None and errwrite not in (p2cread, c2pwrite, 2): os.close(errwrite)
os.close(errwrite)
# Close all other fds, if asked for
# Close all other fds, if asked for if close_fds:
if close_fds: self._close_fds(but=errpipe_write)
self._close_fds(but=errpipe_write)
if cwd is not None:
if cwd is not None: os.chdir(cwd)
os.chdir(cwd)
if preexec_fn:
if preexec_fn: apply(preexec_fn)
apply(preexec_fn)
if env is None:
if env is None: os.execvp(executable, args)
os.execvp(executable, args) else:
else: os.execvpe(executable, args, env)
os.execvpe(executable, args, env)
except:
except: exc_type, exc_value, tb = sys.exc_info()
exc_type, exc_value, tb = sys.exc_info() # Save the traceback and attach it to the exception object
# Save the traceback and attach it to the exception object exc_lines = traceback.format_exception(exc_type,
exc_lines = traceback.format_exception(exc_type, exc_value,
exc_value, tb)
tb) exc_value.child_traceback = ''.join(exc_lines)
exc_value.child_traceback = ''.join(exc_lines) os.write(errpipe_write, pickle.dumps(exc_value))
os.write(errpipe_write, pickle.dumps(exc_value))
# This exitcode won't be reported to applications, so it
# This exitcode won't be reported to applications, so it # really doesn't matter what we return.
# really doesn't matter what we return. os._exit(255)
os._exit(255)
# Parent # Parent
if gc_was_enabled: if gc_was_enabled:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment