summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/PyShell.py
diff options
context:
space:
mode:
authorKurt B. Kaiser <kbk@shore.net>2007-02-06 03:21:40 (GMT)
committerKurt B. Kaiser <kbk@shore.net>2007-02-06 03:21:40 (GMT)
commitdddeb0eec4dcb1ba3c408a54ad01e1a1ea4d5670 (patch)
treebd1a757c22614a0efcfe655b320f4335d3d1da29 /Lib/idlelib/PyShell.py
parentecf796ed4399db200247a705a607663e5bf32410 (diff)
downloadcpython-dddeb0eec4dcb1ba3c408a54ad01e1a1ea4d5670.zip
cpython-dddeb0eec4dcb1ba3c408a54ad01e1a1ea4d5670.tar.gz
cpython-dddeb0eec4dcb1ba3c408a54ad01e1a1ea4d5670.tar.bz2
Clean up ModifiedInterpreter.runcode() structure
Diffstat (limited to 'Lib/idlelib/PyShell.py')
-rw-r--r--Lib/idlelib/PyShell.py56
1 files changed, 29 insertions, 27 deletions
diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py
index addd90e..aaa40c4 100644
--- a/Lib/idlelib/PyShell.py
+++ b/Lib/idlelib/PyShell.py
@@ -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: