]> granicus.if.org Git - python/commitdiff
Debugger was tracing through rpc.py when IDLEfork was not started
authorKurt B. Kaiser <kbk@shore.net>
Wed, 1 Jan 2003 00:26:41 +0000 (00:26 +0000)
committerKurt B. Kaiser <kbk@shore.net>
Wed, 1 Jan 2003 00:26:41 +0000 (00:26 +0000)
from its source directory.  Generalize the "workaround" (though
the latter seems a reasonable solution?) to handle this.

Lib/idlelib/Debugger.py

index 3ad6a83f2d8c3f8fff4520c03b26b678747dab62..5f851821768fbc59690cfb5593a7cb7648d0fb25 100644 (file)
@@ -15,7 +15,7 @@ class Idb(bdb.Bdb):
     def user_line(self, frame):
 
         co_filename = frame.f_code.co_filename
-        co_name = frame.f_code.co_name
+##        co_name = frame.f_code.co_name
 
         ## print>>sys.__stderr__, "*function: ", frame.f_code.co_name
         ## print>>sys.__stderr__, "*file: ", frame.f_code.co_filename
@@ -23,28 +23,26 @@ class Idb(bdb.Bdb):
         ## print>>sys.__stderr__, "*name: ", co_name
         ## print>>sys.__stderr__, "*function: ", frame.f_locals.get(co_name,None)
 
-        try:
-            # XXX 12 Dec 2002 CGT TO DO: Find way to get a reference to the
-            # XXX currently running function. If the function has an
-            #     attribute called "DebuggerStepThrough", prevent the debugger
-            #     from stepping through Idle code. The following doesn't work
-            #     in instance methods. Hard coded some workarounds.
-
-            func = frame.f_locals[co_name]
-            if getattr(func, "DebuggerStepThrough", 0):
-                print "XXXX DEBUGGER STEPPING THROUGH"
-                self.set_step()
-                return
-        except:
-            pass
+##         try:
+##             # XXX 12 Dec 2002 CGT TO DO: Find way to get a reference to the
+##             # XXX currently running function. If the function has an
+##             #     attribute called "DebuggerStepThrough", prevent the debugger
+##             #     from stepping through Idle code. The following doesn't work
+##             #     in instance methods. Hard coded some workarounds.
+##             func = frame.f_locals[co_name]
+##             if getattr(func, "DebuggerStepThrough", 0):
+##                 print "XXXX DEBUGGER STEPPING THROUGH"
+##                 self.set_step()
+##                 return
+##         except:
+##             pass
 
         # workaround for the problem above
-        if co_filename in (r'.\rpc.py', 'rpc.py','<string>'):
-            self.set_step()
-            return
-        if co_filename.endswith('threading.py'):
-            self.set_step()
-            return
+        exclude = ('rpc.py', 'threading.py', '<string>')
+        for rpcfile in exclude:
+            if co_filename.count(rpcfile):
+                self.set_step()
+                return
         message = self.__frame2message(frame)
         self.gui.interaction(message, frame)