DebugClients/Python3/coverage/pytracer.py

changeset 5051
3586ebd9fac8
parent 4489
d0d6e4ad31bd
--- a/DebugClients/Python3/coverage/pytracer.py	Sat Jul 23 13:33:54 2016 +0200
+++ b/DebugClients/Python3/coverage/pytracer.py	Sun Jul 24 12:01:01 2016 +0200
@@ -92,9 +92,12 @@
                 self.cur_file_dict = self.data[tracename]
             # The call event is really a "start frame" event, and happens for
             # function calls and re-entering generators.  The f_lasti field is
-            # -1 for calls, and a real offset for generators.  Use -1 as the
+            # -1 for calls, and a real offset for generators.  Use <0 as the
             # line number for calls, and the real line number for generators.
-            self.last_line = -1 if (frame.f_lasti < 0) else frame.f_lineno
+            if frame.f_lasti < 0:
+                self.last_line = -frame.f_code.co_firstlineno
+            else:
+                self.last_line = frame.f_lineno
         elif event == 'line':
             # Record an executed line.
             if self.cur_file_dict is not None:
@@ -134,7 +137,7 @@
     def stop(self):
         """Stop this Tracer."""
         self.stopped = True
-        if self.threading and self.thread != self.threading.currentThread():
+        if self.threading and self.thread.ident != self.threading.currentThread().ident:
             # Called on a different thread than started us: we can't unhook
             # ourselves, but we've set the flag that we should stop, so we
             # won't do any more tracing.

eric ide

mercurial