summaryrefslogtreecommitdiff
path: root/coverage/pytracer.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2014-09-20 08:39:40 -0400
committerNed Batchelder <ned@nedbatchelder.com>2014-09-20 08:39:40 -0400
commit893f0851afd273e41386a0e71af88b0a0ba12db0 (patch)
treee816b971dd2dc5a0c96ddde299097851408897e0 /coverage/pytracer.py
parent464177900ae028c466fd5fca69b85d6b81b12855 (diff)
downloadpython-coveragepy-893f0851afd273e41386a0e71af88b0a0ba12db0.tar.gz
Coroutines are now only supported with the C tracer, and better error handling
Diffstat (limited to 'coverage/pytracer.py')
-rw-r--r--coverage/pytracer.py17
1 files changed, 4 insertions, 13 deletions
diff --git a/coverage/pytracer.py b/coverage/pytracer.py
index 733abb1..a82b32c 100644
--- a/coverage/pytracer.py
+++ b/coverage/pytracer.py
@@ -1,6 +1,6 @@
"""Raw data collector for Coverage."""
-import collections, sys
+import sys
class PyTracer(object):
@@ -38,13 +38,10 @@ class PyTracer(object):
self.last_line = [0]
self.data_stack = []
- self.data_stacks = collections.defaultdict(list)
self.last_exc_back = None
self.last_exc_firstlineno = 0
self.thread = None
self.stopped = False
- self.coroutine_id_func = None
- self.last_coroutine = None
def __repr__(self):
return "<PyTracer at 0x{0:0x}: {1} lines in {2} files>".format(
@@ -65,8 +62,6 @@ class PyTracer(object):
if self.arcs and self.cur_file_dict:
pair = (self.last_line, -self.last_exc_firstlineno)
self.cur_file_dict[pair] = None
- if self.coroutine_id_func:
- self.data_stack = self.data_stacks[self.coroutine_id_func()]
self.plugin, self.cur_file_dict, self.last_line = (
self.data_stack.pop()
)
@@ -75,9 +70,6 @@ class PyTracer(object):
if event == 'call':
# Entering a new function context. Decide if we should trace
# in this file.
- if self.coroutine_id_func:
- self.data_stack = self.data_stacks[self.coroutine_id_func()]
- self.last_coroutine = self.coroutine_id_func()
self.data_stack.append(
(self.plugin, self.cur_file_dict, self.last_line)
)
@@ -119,7 +111,9 @@ class PyTracer(object):
if lineno_from != -1:
if self.cur_file_dict is not None:
if self.arcs:
- self.cur_file_dict[(self.last_line, lineno_from)] = None
+ self.cur_file_dict[
+ (self.last_line, lineno_from)
+ ] = None
else:
for lineno in range(lineno_from, lineno_to+1):
self.cur_file_dict[lineno] = None
@@ -129,9 +123,6 @@ class PyTracer(object):
first = frame.f_code.co_firstlineno
self.cur_file_dict[(self.last_line, -first)] = None
# Leaving this function, pop the filename stack.
- if self.coroutine_id_func:
- self.data_stack = self.data_stacks[self.coroutine_id_func()]
- self.last_coroutine = self.coroutine_id_func()
self.plugin, self.cur_file_dict, self.last_line = (
self.data_stack.pop()
)