Clean up ModifiedInterpreter.runcode() structure
This commit is contained in:
parent
ecf796ed43
commit
dddeb0eec4
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue