diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2014-09-06 14:24:15 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2014-09-06 14:24:15 -0400 |
commit | 0891e02eb490494ee40a7f840e4ab9fd6b3d2d7b (patch) | |
tree | 394c5e68d986579d94a153b15dee8ac977c643bd /coverage/tracer.c | |
parent | 7862e1fee15b6ef8fcadfd112cf93121ed8f388e (diff) | |
download | python-coveragepy-git-0891e02eb490494ee40a7f840e4ab9fd6b3d2d7b.tar.gz |
Move dispositions closer to useful plugins
Diffstat (limited to 'coverage/tracer.c')
-rw-r--r-- | coverage/tracer.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/coverage/tracer.c b/coverage/tracer.c index ca8d61c1..c0066046 100644 --- a/coverage/tracer.c +++ b/coverage/tracer.c @@ -260,6 +260,7 @@ CTracer_trace(CTracer *self, PyFrameObject *frame, int what, PyObject *arg_unuse PyObject * filename = NULL; PyObject * tracename = NULL; PyObject * disposition = NULL; + PyObject * disp_trace = NULL; #if WHAT_LOG || TRACE_LOG PyObject * ascii = NULL; #endif @@ -358,13 +359,28 @@ CTracer_trace(CTracer *self, PyFrameObject *frame, int what, PyObject *arg_unuse Py_INCREF(disposition); } - /* If tracename is a string, then we're supposed to trace. */ - tracename = PyObject_GetAttrString(disposition, "filename"); - if (tracename == NULL) { + disp_trace = PyObject_GetAttrString(disposition, "trace"); + if (disp_trace == NULL) { STATS( self->stats.errors++; ) Py_DECREF(disposition); return RET_ERROR; } + + tracename = Py_None; + Py_INCREF(tracename); + + if (disp_trace == Py_True) { + /* If tracename is a string, then we're supposed to trace. */ + tracename = PyObject_GetAttrString(disposition, "source_filename"); + if (tracename == NULL) { + STATS( self->stats.errors++; ) + Py_DECREF(disposition); + Py_DECREF(disp_trace); + return RET_ERROR; + } + } + Py_DECREF(disp_trace); + if (MyText_Check(tracename)) { PyObject * file_data = PyDict_GetItem(self->data, tracename); if (file_data == NULL) { |