summaryrefslogtreecommitdiff
path: root/coverage/tracer.c
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2010-11-06 16:49:23 -0400
committerNed Batchelder <ned@nedbatchelder.com>2010-11-06 16:49:23 -0400
commit226aa60227cc4e9e39d71dd1bbbcfe77c83f0280 (patch)
treeb5a13149a73adaf3cc895ba274380ca752d700d9 /coverage/tracer.c
parent968bbe56458fa91e19222cf879d4cb1bda213bac (diff)
downloadpython-coveragepy-226aa60227cc4e9e39d71dd1bbbcfe77c83f0280.tar.gz
Detect when our trace function is yanked out from under us, and warn the user. Finishes, but does not fix, issue #93.
Diffstat (limited to 'coverage/tracer.c')
-rw-r--r--coverage/tracer.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/coverage/tracer.c b/coverage/tracer.c
index 9eb3cca..e046596 100644
--- a/coverage/tracer.c
+++ b/coverage/tracer.c
@@ -63,6 +63,7 @@ typedef struct {
/* Python objects manipulated directly by the Collector class. */
PyObject * should_trace;
+ PyObject * warn;
PyObject * data;
PyObject * should_trace_cache;
PyObject * arcs;
@@ -134,6 +135,7 @@ Tracer_init(Tracer *self, PyObject *args_unused, PyObject *kwds_unused)
#endif /* COLLECT_STATS */
self->should_trace = NULL;
+ self->warn = NULL;
self->data = NULL;
self->should_trace_cache = NULL;
self->arcs = NULL;
@@ -166,6 +168,7 @@ Tracer_dealloc(Tracer *self)
}
Py_XDECREF(self->should_trace);
+ Py_XDECREF(self->warn);
Py_XDECREF(self->data);
Py_XDECREF(self->should_trace_cache);
@@ -539,6 +542,9 @@ Tracer_members[] = {
{ "should_trace", T_OBJECT, offsetof(Tracer, should_trace), 0,
PyDoc_STR("Function indicating whether to trace a file.") },
+ { "warn", T_OBJECT, offsetof(Tracer, warn), 0,
+ PyDoc_STR("Function for issuing warnings.") },
+
{ "data", T_OBJECT, offsetof(Tracer, data), 0,
PyDoc_STR("The raw dictionary of trace data.") },