Show correct line number on specific exceptions.

Wed, 30 Jan 2019 22:37:32 +0100

author
T.Rzepka <Tobias.Rzepka@gmail.com>
date
Wed, 30 Jan 2019 22:37:32 +0100
changeset 6687
352a7abb5582
parent 6686
f7f19fe6a02f
child 6688
a821e5acf24d

Show correct line number on specific exceptions.

DebugClients/Python/DebugBase.py file | annotate | diff | comparison | revisions
changelog file | annotate | diff | comparison | revisions
--- a/DebugClients/Python/DebugBase.py	Wed Jan 30 18:59:31 2019 +0100
+++ b/DebugClients/Python/DebugBase.py	Wed Jan 30 22:37:32 2019 +0100
@@ -708,10 +708,11 @@
         @return list of lists with file name (string), line number (integer)
             and function name (string)
         """
+        tb_lineno = None
         if frame is None:
             fr = self.getCurrentFrame()
         elif type(frame) == list:
-            fr = frame.pop(0)
+            fr, tb_lineno = frame.pop(0)
         else:
             fr = frame
         
@@ -732,7 +733,7 @@
                      "ThreadExtension.py", "threading.py")):
                 break
             
-            fline = fr.f_lineno
+            fline = tb_lineno or fr.f_lineno
             ffunc = fr.f_code.co_name
             
             if ffunc == '?':
@@ -754,7 +755,7 @@
             # is it a stack frame or exception list?
             if type(frame) == list:
                 if frame != []:
-                    fr = frame.pop(0)
+                    fr, tb_lineno = frame.pop(0)
                 else:
                     fr = None
             else:
@@ -886,7 +887,7 @@
             frlist = self.__extract_stack(exctb)
             frlist.reverse()
             
-            self.currentFrame = frlist[0]
+            self.currentFrame = frlist[0][0]
             stack = self.getStack(frlist[self.skipFrames:])
         
         self._dbgClient.lockClient()
@@ -936,7 +937,7 @@
         tb = exctb
         stack = []
         while tb is not None:
-            stack.append(tb.tb_frame)
+            stack.append((tb.tb_frame, tb.tb_lineno))
             tb = tb.tb_next
         tb = None
         return stack
--- a/changelog	Wed Jan 30 18:59:31 2019 +0100
+++ b/changelog	Wed Jan 30 22:37:32 2019 +0100
@@ -2,6 +2,9 @@
 ----------
 Version 19.02:
 - bug fixes
+- Debugger
+  -- show / stop at correct line number if an exception happen in a with
+     statement or specific try-except clauses where no breakpoint are set
 - Editor
   -- added cpability to suppress some markers in the marker map
 - Multi Project

eric ide

mercurial