diff options
author | Kurt B. Kaiser <kbk@shore.net> | 2007-02-06 03:21:40 (GMT) |
---|---|---|
committer | Kurt B. Kaiser <kbk@shore.net> | 2007-02-06 03:21:40 (GMT) |
commit | dddeb0eec4dcb1ba3c408a54ad01e1a1ea4d5670 (patch) | |
tree | bd1a757c22614a0efcfe655b320f4335d3d1da29 /Lib/idlelib/PyShell.py | |
parent | ecf796ed4399db200247a705a607663e5bf32410 (diff) | |
download | cpython-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.py | 56 |
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: |