summaryrefslogtreecommitdiff
path: root/coverage
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2015-10-03 22:17:29 -0400
committerNed Batchelder <ned@nedbatchelder.com>2015-10-03 22:17:29 -0400
commit6bf4946e0bc8599a1258c5107f7eece2efa70925 (patch)
tree7912a27d6f355d0f42981669b60e3490a2851c11 /coverage
parent067544951e8da9dd06478ca221090c506e364a6a (diff)
downloadpython-coveragepy-git-6bf4946e0bc8599a1258c5107f7eece2efa70925.tar.gz
No more speed penalty for settrace(gettrace()). #397.
Diffstat (limited to 'coverage')
-rw-r--r--coverage/ctracer/tracer.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/coverage/ctracer/tracer.c b/coverage/ctracer/tracer.c
index 23472575..e5f39d09 100644
--- a/coverage/ctracer/tracer.c
+++ b/coverage/ctracer/tracer.c
@@ -903,6 +903,10 @@ CTracer_call(CTracer *self, PyObject *args, PyObject *kwds)
/* Clean up. */
frame->f_lineno = orig_lineno;
+ /* For better speed, install ourselves the C way so that future calls go
+ directly to CTracer_trace, without this intermediate function. */
+ PyEval_SetTrace((Py_tracefunc)CTracer_trace, (PyObject*)self);
+
done:
return ret;
}