diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2014-09-20 08:39:40 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2014-09-20 08:39:40 -0400 |
commit | 3f672471a52a115fd747bb9b02dbc6f08605cf35 (patch) | |
tree | da61c89ae4d6360b4d4ea576690395b1cfac18a5 /coverage/pytracer.py | |
parent | 0f28946543966ae1265ec2345c7eeb3b31186136 (diff) | |
download | python-coveragepy-git-3f672471a52a115fd747bb9b02dbc6f08605cf35.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.py | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/coverage/pytracer.py b/coverage/pytracer.py index 733abb1c..a82b32c9 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() ) |