[Python-3000-checkins] r57671 - python/branches/py3k/Lib/idlelib/Debugger.py python/branches/py3k/Lib/idlelib/RemoteDebugger.py

kurt.kaiser python-3000-checkins at python.org
Wed Aug 29 20:44:25 CEST 2007


Author: kurt.kaiser
Date: Wed Aug 29 20:44:24 2007
New Revision: 57671

Modified:
   python/branches/py3k/Lib/idlelib/Debugger.py
   python/branches/py3k/Lib/idlelib/RemoteDebugger.py
Log:
1. Debugger was failing to start due to DictProxy limitations.
2. Fix some debug prints in RemoteDebugger.py - use py3k syntax.


Modified: python/branches/py3k/Lib/idlelib/Debugger.py
==============================================================================
--- python/branches/py3k/Lib/idlelib/Debugger.py	(original)
+++ python/branches/py3k/Lib/idlelib/Debugger.py	Wed Aug 29 20:44:24 2007
@@ -446,7 +446,20 @@
             l = Label(subframe, text="None")
             l.grid(row=0, column=0)
         else:
-            names = sorted(dict)
+            #names = sorted(dict)
+            ###
+            # Because of (temporary) limitations on the dict_keys type (not yet
+            # public or pickleable), have the subprocess to send a list of
+            # keys, not a dict_keys object.  sorted() will take a dict_keys
+            # (no subprocess) or a list.
+            #
+            # There is also an obscure bug in sorted(dict) where the
+            # interpreter gets into a loop requesting non-existing dict[0],
+            # dict[1], dict[2], etc from the RemoteDebugger.DictProxy.
+            ###
+            keys_list = dict.keys()
+            names = sorted(keys_list)
+            ###
             row = 0
             for name in names:
                 value = dict[name]

Modified: python/branches/py3k/Lib/idlelib/RemoteDebugger.py
==============================================================================
--- python/branches/py3k/Lib/idlelib/RemoteDebugger.py	(original)
+++ python/branches/py3k/Lib/idlelib/RemoteDebugger.py	Wed Aug 29 20:44:24 2007
@@ -94,16 +94,13 @@
         self.idb.set_return(frame)
 
     def get_stack(self, fid, tbid):
-        ##print >>sys.__stderr__, "get_stack(%r, %r)" % (fid, tbid)
         frame = frametable[fid]
         if tbid is None:
             tb = None
         else:
             tb = tracebacktable[tbid]
         stack, i = self.idb.get_stack(frame, tb)
-        ##print >>sys.__stderr__, "get_stack() ->", stack
         stack = [(wrap_frame(frame), k) for frame, k in stack]
-        ##print >>sys.__stderr__, "get_stack() ->", stack
         return stack, i
 
     def run(self, cmd):
@@ -162,13 +159,20 @@
     #----------called by a DictProxy----------
 
     def dict_keys(self, did):
+        raise NotImplemented("dict_keys not public or pickleable")
+##         dict = dicttable[did]
+##         return dict.keys()
+
+    ### Needed until dict_keys is type is finished and pickealable.
+    ### Will probably need to extend rpc.py:SocketIO._proxify at that time.
+    def dict_keys_list(self, did):
         dict = dicttable[did]
         return list(dict.keys())
 
     def dict_item(self, did, key):
         dict = dicttable[did]
         value = dict[key]
-        value = repr(value)
+        value = repr(value) ### can't pickle module '__builtin__'
         return value
 
 #----------end class IdbAdapter----------
@@ -261,15 +265,20 @@
         self._oid = oid
         self._did = did
 
+##    def keys(self):
+##        return self._conn.remotecall(self._oid, "dict_keys", (self._did,), {})
+
+    # 'temporary' until dict_keys is a pickleable built-in type
     def keys(self):
-        return self._conn.remotecall(self._oid, "dict_keys", (self._did,), {})
+        return self._conn.remotecall(self._oid,
+                                     "dict_keys_list", (self._did,), {})
 
     def __getitem__(self, key):
         return self._conn.remotecall(self._oid, "dict_item",
                                      (self._did, key), {})
 
     def __getattr__(self, name):
-        ##print >>sys.__stderr__, "failed DictProxy.__getattr__:", name
+        ##print("*** Failed DictProxy.__getattr__:", name)
         raise AttributeError(name)
 
 
@@ -280,7 +289,7 @@
         self.gui = gui
 
     def interaction(self, message, fid, modified_info):
-        ##print "interaction: (%s, %s, %s)" % (message, fid, modified_info)
+        ##print("*** Interaction: (%s, %s, %s)" % (message, fid, modified_info))
         frame = FrameProxy(self.conn, fid)
         self.gui.interaction(message, frame, modified_info)
 
@@ -293,9 +302,9 @@
         self.shell = shell
 
     def call(self, methodname, *args, **kwargs):
-        ##print "**IdbProxy.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 "**IdbProxy.call %s returns %r" % (methodname, value)
+        ##print("*** IdbProxy.call %s returns %r" % (methodname, value))
         return value
 
     def run(self, cmd, locals):


More information about the Python-3000-checkins mailing list