DebugClients/Python3/DebugBase.py

branch
debugger speed
changeset 5050
a6335e924d08
parent 5048
9899fb545b1f
child 5062
904225763ac0
--- a/DebugClients/Python3/DebugBase.py	Sat Jul 23 14:13:50 2016 +0200
+++ b/DebugClients/Python3/DebugBase.py	Sat Jul 23 14:15:43 2016 +0200
@@ -75,6 +75,9 @@
         
         self.tracePythonLibs(0)
         
+        # Special handling of a recursion error
+        self.skipFrames = 0
+        
         self.__isBroken = False
         self.cFrame = None
         
@@ -680,6 +683,24 @@
                 self._dbgClient.eventLoop()
                 return
         
+        self.skipFrames = 0
+        if (exctype == RuntimeError and
+                str(excval).startswith('maximum recursion depth exceeded') or
+                sys.version_info >= (3, 5) and exctype == RecursionError):
+            excval = 'maximum recursion depth exceeded'
+            depth = 0
+            tb = exctb
+            while tb:
+                tb = tb.tb_next
+                
+                if (tb and tb.tb_frame.f_code.co_name == 'trace_dispatch' and
+                        __file__.startswith(tb.tb_frame.f_code.co_filename)):
+                    depth = 1
+                self.skipFrames += depth
+            
+            # always 1 if running without debugger
+            self.skipFrames = max(1, self.skipFrames)
+        
         exctype = self.__extractExceptionName(exctype)
         
         if excval is None:
@@ -700,7 +721,7 @@
             
             self.currentFrame = frlist[0]
             
-            for fr in frlist:
+            for fr in frlist[self.skipFrames:]:
                 filename = self._dbgClient.absPath(self.fix_frame_filename(fr))
                 
                 if os.path.basename(filename).startswith("DebugClient") or \
@@ -733,7 +754,8 @@
             return
         
         self._dbgClient.eventLoop()
-    
+        self.skipFrames = 0
+        
     def __extractExceptionName(self, exctype):
         """
         Private method to extract the exception name given the exception

eric ide

mercurial