diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2010-10-13 09:42:50 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2010-10-13 09:42:50 -0400 |
commit | 975ccb0ec19c427f5759b16f5184e6bc557636ac (patch) | |
tree | 3c70496040256d61f1d8762c45ae4536fe007d9f /coverage/collector.py | |
parent | 3f4d00fc8d55c92e4799cb3d26d75b169db9a414 (diff) | |
download | python-coveragepy-975ccb0ec19c427f5759b16f5184e6bc557636ac.tar.gz |
Use 2-and-3-friendly syntax in the debugging prints in the trace function.
Diffstat (limited to 'coverage/collector.py')
-rw-r--r-- | coverage/collector.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/coverage/collector.py b/coverage/collector.py index decdba9..6b196e9 100644 --- a/coverage/collector.py +++ b/coverage/collector.py @@ -43,8 +43,8 @@ class PyTracer(object): def _trace(self, frame, event, arg_unused): """The trace function passed to sys.settrace.""" - #print "trace event: %s %r @%d" % ( - # event, frame.f_code.co_filename, frame.f_lineno) + #print("trace event: %s %r @%d" % ( + # event, frame.f_code.co_filename, frame.f_lineno)) if self.last_exc_back: if frame == self.last_exc_back: @@ -64,6 +64,8 @@ class PyTracer(object): if tracename is None: tracename = self.should_trace(filename, frame) self.should_trace_cache[filename] = tracename + #print("called, stack is %d deep, tracename is %r" % ( + # len(self.data_stack), tracename)) if tracename: if tracename not in self.data: self.data[tracename] = {} @@ -77,10 +79,10 @@ class PyTracer(object): # Record an executed line. if self.cur_file_data is not None: if self.arcs: - #print "lin", self.last_line, frame.f_lineno + #print("lin", self.last_line, frame.f_lineno) self.cur_file_data[(self.last_line, frame.f_lineno)] = None else: - #print "lin", frame.f_lineno + #print("lin", frame.f_lineno) self.cur_file_data[frame.f_lineno] = None self.last_line = frame.f_lineno elif event == 'return': @@ -89,8 +91,9 @@ class PyTracer(object): self.cur_file_data[(self.last_line, -first)] = None # Leaving this function, pop the filename stack. self.cur_file_data, self.last_line = self.data_stack.pop() + #print("returned, stack is %d deep" % (len(self.data_stack))) elif event == 'exception': - #print "exc", self.last_line, frame.f_lineno + #print("exc", self.last_line, frame.f_lineno) self.last_exc_back = frame.f_back self.last_exc_firstlineno = frame.f_code.co_firstlineno return self._trace |