Clean up ModifiedInterpreter.runcode() structure

This commit is contained in:
Kurt B. Kaiser 2007-02-06 03:21:40 +00:00
parent ecf796ed43
commit dddeb0eec4
1 changed files with 29 additions and 27 deletions

View File

@ -706,35 +706,37 @@ class ModifiedInterpreter(InteractiveInterpreter):
debugger = self.debugger
try:
self.tkconsole.beginexecuting()
try:
if not debugger and self.rpcclt is not None:
self.active_seq = self.rpcclt.asyncqueue("exec", "runcode",
(code,), {})
elif debugger:
debugger.run(code, self.locals)
else:
exec code in self.locals
except SystemExit:
if not self.tkconsole.closing:
if tkMessageBox.askyesno(
"Exit?",
"Do you want to exit altogether?",
default="yes",
master=self.tkconsole.text):
raise
else:
self.showtraceback()
else:
if not debugger and self.rpcclt is not None:
self.active_seq = self.rpcclt.asyncqueue("exec", "runcode",
(code,), {})
elif debugger:
debugger.run(code, self.locals)
else:
exec code in self.locals
except SystemExit:
if not self.tkconsole.closing:
if tkMessageBox.askyesno(
"Exit?",
"Do you want to exit altogether?",
default="yes",
master=self.tkconsole.text):
raise
except:
if use_subprocess:
# When run w/o subprocess, both user and IDLE errors
# are printed here; skip message in that case.
print >> self.tkconsole.stderr, \
"IDLE internal error in runcode()"
else:
self.showtraceback()
else:
raise
except:
if use_subprocess:
print >>self.tkconsole.stderr, \
"IDLE internal error in runcode()"
self.showtraceback()
if use_subprocess:
self.tkconsole.endexecuting()
self.tkconsole.endexecuting()
else:
if self.tkconsole.canceled:
self.tkconsole.canceled = False
print >>self.tkconsole.stderr, "KeyboardInterrupt"
else:
self.showtraceback()
finally:
if not use_subprocess:
try: