diff options
author | Kurt B. Kaiser <kbk@shore.net> | 2003-06-02 01:50:19 (GMT) |
---|---|---|
committer | Kurt B. Kaiser <kbk@shore.net> | 2003-06-02 01:50:19 (GMT) |
commit | 9f3660972003dddcc1cced41934488513e277220 (patch) | |
tree | 15b13d1cc739814069bdd6ede8d252406585a7f0 /Lib/idlelib/run.py | |
parent | 5da131b2df84d0b91fbce739eba46ad170188d5e (diff) | |
download | cpython-9f3660972003dddcc1cced41934488513e277220.zip cpython-9f3660972003dddcc1cced41934488513e277220.tar.gz cpython-9f3660972003dddcc1cced41934488513e277220.tar.bz2 |
Modify the remote stack viewer to work in the threaded subprocess.
M PyShell.py
M run.py
Diffstat (limited to 'Lib/idlelib/run.py')
-rw-r--r-- | Lib/idlelib/run.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/Lib/idlelib/run.py b/Lib/idlelib/run.py index 7d7a6e8..8b1555d 100644 --- a/Lib/idlelib/run.py +++ b/Lib/idlelib/run.py @@ -207,9 +207,10 @@ class MyHandler(rpc.RPCHandler): """Override base method""" executive = Executive(self) self.register("exec", executive) - sys.stdin = self.get_remote_proxy("stdin") + sys.stdin = self.console = self.get_remote_proxy("stdin") sys.stdout = self.get_remote_proxy("stdout") sys.stderr = self.get_remote_proxy("stderr") + self.interp = self.get_remote_proxy("interp") rpc.RPCHandler.getresponse(self, myseq=None, wait=0.05) def exithook(self): @@ -238,12 +239,17 @@ class Executive: def runcode(self, code): try: + self.usr_exc_info = None exec code in self.locals except: + self.usr_exc_info = sys.exc_info() if quitting: exit() # even print a user code SystemExit exception, continue print_exception() + jit = self.rpchandler.console.getvar("<<toggle-jit-stack-viewer>>") + if jit: + self.rpchandler.interp.open_remote_stack_viewer() else: flush_stdout() @@ -261,13 +267,16 @@ class Executive: return self.calltip.fetch_tip(name) def stackviewer(self, flist_oid=None): - if not hasattr(sys, "last_traceback"): + if self.usr_exc_info: + typ, val, tb = self.usr_exc_info + else: return None flist = None if flist_oid is not None: flist = self.rpchandler.get_remote_proxy(flist_oid) - tb = sys.last_traceback while tb and tb.tb_frame.f_globals["__name__"] in ["rpc", "run"]: tb = tb.tb_next + sys.last_type = typ + sys.last_value = val item = StackViewer.StackTreeItem(flist, tb) return RemoteObjectBrowser.remote_object_tree_item(item) |