summaryrefslogtreecommitdiff
path: root/coverage/collector.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2011-08-07 22:09:40 -0400
committerNed Batchelder <ned@nedbatchelder.com>2011-08-07 22:09:40 -0400
commitcbf42dc7273bfb828c8124c7b7229be15c15b202 (patch)
treeb400724c25b029f2165f410c45339b5a16863019 /coverage/collector.py
parent06e4538fca309d796d6e8f899bcad74146a96ff3 (diff)
downloadpython-coveragepy-git-cbf42dc7273bfb828c8124c7b7229be15c15b202.tar.gz
An enormous hack to try to get stdlib measurement from the very beginning of the process.
Diffstat (limited to 'coverage/collector.py')
-rw-r--r--coverage/collector.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/coverage/collector.py b/coverage/collector.py
index 9c40d16c..9752e530 100644
--- a/coverage/collector.py
+++ b/coverage/collector.py
@@ -233,8 +233,25 @@ class Collector(object):
self._collectors[-1].pause()
self._collectors.append(self)
#print >>sys.stderr, "Started: %r" % self._collectors
+
+ # Check to see whether we had a fullcoverage tracer installed.
+ traces0 = None
+ if hasattr(sys, "gettrace"):
+ fn0 = sys.gettrace()
+ if fn0:
+ tracer0 = getattr(fn0, '__self__', None)
+ if tracer0:
+ traces0 = getattr(tracer0, 'traces', None)
+
# Install the tracer on this thread.
- self._start_tracer()
+ fn = self._start_tracer()
+
+ if traces0:
+ #print("traces0 has %d" % len(traces0))
+ for args in traces0:
+ frame, event, arg = args
+ fn(*args)
+
# Install our installation tracer in threading, to jump start other
# threads.
threading.settrace(self._installation_trace)