diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2015-06-03 07:22:39 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2015-06-03 07:22:39 -0400 |
commit | d328c46442495e7701d3d895e2ddb1da7fa728d8 (patch) | |
tree | 2881382daccd65f9054b77bd2e812f7aabfa99de /coverage/tracer.c | |
parent | ce675fdb6da663139bba8c801986ea5801caa893 (diff) | |
download | python-coveragepy-git-d328c46442495e7701d3d895e2ddb1da7fa728d8.tar.gz |
Make sure not to call functions with an error set.
Python 3.5 is stricter about getting this right. So we have to call PyErr_Print
to print and clear the error before calling the warn function.
Diffstat (limited to 'coverage/tracer.c')
-rw-r--r-- | coverage/tracer.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/coverage/tracer.c b/coverage/tracer.c index fe40fc67..875bfea6 100644 --- a/coverage/tracer.c +++ b/coverage/tracer.c @@ -647,6 +647,8 @@ CTracer_disable_plugin(CTracer *self, PyObject * disposition) PyObject * msg = NULL; PyObject * ignored = NULL; + PyErr_Print(); + file_tracer = PyObject_GetAttrString(disposition, "file_tracer"); if (file_tracer == NULL) { goto error; @@ -664,7 +666,7 @@ CTracer_disable_plugin(CTracer *self, PyObject * disposition) goto error; } msg = MyText_FromFormat( - "Disabling plugin '%s' due to an exception:", + "Disabling plugin '%s' due to previous exception", MyText_AsString(plugin_name) ); if (msg == NULL) { @@ -675,8 +677,6 @@ CTracer_disable_plugin(CTracer *self, PyObject * disposition) goto error; } - PyErr_Print(); - /* Disable the plugin for future files, and stop tracing this file. */ if (PyObject_SetAttrString(plugin, "_coverage_enabled", Py_False) < 0) { goto error; |