diff options
Diffstat (limited to 'coverage/ctracer')
-rw-r--r-- | coverage/ctracer/datastack.h | 2 | ||||
-rw-r--r-- | coverage/ctracer/tracer.c | 6 | ||||
-rw-r--r-- | coverage/ctracer/tracer.h | 9 |
3 files changed, 8 insertions, 9 deletions
diff --git a/coverage/ctracer/datastack.h b/coverage/ctracer/datastack.h index 3b3078ba..c383e1e1 100644 --- a/coverage/ctracer/datastack.h +++ b/coverage/ctracer/datastack.h @@ -12,7 +12,7 @@ * possible. */ typedef struct DataStackEntry { - /* The current file_data dictionary. Owned. */ + /* The current file_data set. Owned. */ PyObject * file_data; /* The disposition object for this frame. A borrowed instance of CFileDisposition. */ diff --git a/coverage/ctracer/tracer.c b/coverage/ctracer/tracer.c index a3daacb6..00d9f106 100644 --- a/coverage/ctracer/tracer.c +++ b/coverage/ctracer/tracer.c @@ -182,7 +182,7 @@ CTracer_record_pair(CTracer *self, int l1, int l2) goto error; } - if (PyDict_SetItem(self->pcur_entry->file_data, t, Py_None) < 0) { + if (PySet_Add(self->pcur_entry->file_data, t) < 0) { goto error; } @@ -504,7 +504,7 @@ CTracer_handle_call(CTracer *self, PyFrameObject *frame) if (PyErr_Occurred()) { goto error; } - file_data = PyDict_New(); + file_data = PySet_New(NULL); if (file_data == NULL) { goto error; } @@ -674,7 +674,7 @@ CTracer_handle_line(CTracer *self, PyFrameObject *frame) goto error; } - ret2 = PyDict_SetItem(self->pcur_entry->file_data, this_line, Py_None); + ret2 = PySet_Add(self->pcur_entry->file_data, this_line); Py_DECREF(this_line); if (ret2 < 0) { goto error; diff --git a/coverage/ctracer/tracer.h b/coverage/ctracer/tracer.h index 8994a9e3..fbbfa202 100644 --- a/coverage/ctracer/tracer.h +++ b/coverage/ctracer/tracer.h @@ -39,15 +39,14 @@ typedef struct CTracer { PyObject * context; /* - The data stack is a stack of dictionaries. Each dictionary collects + The data stack is a stack of sets. Each set collects data for a single source file. The data stack parallels the call stack: each call pushes the new frame's file data onto the data stack, and each return pops file data off. - The file data is a dictionary whose form depends on the tracing options. - If tracing arcs, the keys are line number pairs. If not tracing arcs, - the keys are line numbers. In both cases, the value is irrelevant - (None). + The file data is a set whose form depends on the tracing options. + If tracing arcs, the values are line number pairs. If not tracing arcs, + the values are line numbers. */ DataStack data_stack; /* Used if we aren't doing concurrency. */ |