M PyShell.py
M RemoteDebugger.py
M rpc.py
Fix the incorrect shell exception tracebacks generated when running
under debugger control:
1. Use rpc.SocketIO.asynccall() instead of remotecall() to handle the
IdbProxy.run() command.
2. Add a 'shell' attribute to RemoteDebugger.IdbProxy to allow setting
of ModifiedInterpreter's active_seq attribute from RemoteDebugger code.
3. Cleanup PyShell.ModifiedInterpreter.runcode() and remove ambiguity
regarding use of begin/endexecuting().
4. In runcode() and cleanup_traceback() use 'console' instead of 'file' to
denote the entity to which the exception traceback is printed.
5. Enhance cleanup_traceback() so if the traceback is pruned entirely away
(the error is in IDLE internals) it will be displayed in its entirety
instead.
6. ModifiedInterpreter.runcode() now prints ERROR RPC returns to both
console and __stderr__.
7. Make a small tweak to the rpc.py debug messages.
diff --git a/Lib/idlelib/RemoteDebugger.py b/Lib/idlelib/RemoteDebugger.py
index 054b975..41f910f 100644
--- a/Lib/idlelib/RemoteDebugger.py
+++ b/Lib/idlelib/RemoteDebugger.py
@@ -287,19 +287,21 @@
class IdbProxy:
- def __init__(self, conn, oid):
+ def __init__(self, conn, shell, oid):
self.oid = oid
self.conn = conn
+ self.shell = shell
def call(self, methodname, *args, **kwargs):
- ##print "call %s %s %s" % (methodname, args, kwargs)
+ ##print "**IdbProxy.call %s %s %s" % (methodname, args, kwargs)
value = self.conn.remotecall(self.oid, methodname, args, kwargs)
- ##print "return %s" % `value`
+ ##print "**IdbProxy.call %s returns %s" % (methodname, `value`)
return value
def run(self, cmd, locals):
# Ignores locals on purpose!
- self.call("run", cmd)
+ seq = self.conn.asynccall(self.oid, "run", (cmd,), {})
+ self.shell.interp.active_seq = seq
def get_stack(self, frame, tbid):
# passing frame and traceback IDs, not the objects themselves
@@ -352,7 +354,7 @@
idb_adap_oid = rpcclt.remotecall("exec", "start_the_debugger",\
(gui_adap_oid,), {})
- idb_proxy = IdbProxy(rpcclt, idb_adap_oid)
+ idb_proxy = IdbProxy(rpcclt, pyshell, idb_adap_oid)
gui = Debugger.Debugger(pyshell, idb_proxy)
gui_adap = GUIAdapter(rpcclt, gui)
rpcclt.register(gui_adap_oid, gui_adap)