summaryrefslogtreecommitdiff
path: root/coverage/tracer.c
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2015-02-18 22:22:38 -0500
committerNed Batchelder <ned@nedbatchelder.com>2015-02-18 22:22:38 -0500
commitd28c7251e43bff2f2cc5a8cc56e6cdbb3973abab (patch)
tree2ac7102dcb3b5dec2c6812d1813eca1d67fe3a55 /coverage/tracer.c
parent0155f1f0619640cce45dd2a3ace367e04c4eb0d2 (diff)
downloadpython-coveragepy-d28c7251e43bff2f2cc5a8cc56e6cdbb3973abab.tar.gz
Make branch=True get along with plugins.
Diffstat (limited to 'coverage/tracer.c')
-rw-r--r--coverage/tracer.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/coverage/tracer.c b/coverage/tracer.c
index 43ecd18..8577afc 100644
--- a/coverage/tracer.c
+++ b/coverage/tracer.c
@@ -638,31 +638,30 @@ CTracer_handle_line(CTracer *self, PyFrameObject *frame)
}
if (lineno_from != -1) {
- if (self->tracing_arcs) {
- /* Tracing arcs: key is (last_line,this_line). */
- /* TODO: this needs to deal with lineno_to also. */
- if (CTracer_record_pair(self, self->cur_entry.last_line, lineno_from) < 0) {
- goto error;
+ for (; lineno_from <= lineno_to; lineno_from++) {
+ if (self->tracing_arcs) {
+ /* Tracing arcs: key is (last_line,this_line). */
+ if (CTracer_record_pair(self, self->cur_entry.last_line, lineno_from) < 0) {
+ goto error;
+ }
}
- }
- else {
- /* Tracing lines: key is simply this_line. */
- while (lineno_from <= lineno_to) {
+ else {
+ /* Tracing lines: key is simply this_line. */
PyObject * this_line = MyInt_FromInt(lineno_from);
if (this_line == NULL) {
goto error;
}
+
ret = PyDict_SetItem(self->cur_entry.file_data, this_line, Py_None);
Py_DECREF(this_line);
if (ret < 0) {
goto error;
}
- lineno_from++;
}
+
+ self->cur_entry.last_line = lineno_from;
}
}
-
- self->cur_entry.last_line = lineno_to;
}
}