From 609f0615c055837dece6446a4e58926a92591f02 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Wed, 3 Jun 2015 07:22:39 -0400 Subject: 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. --- coverage/tracer.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'coverage/tracer.c') diff --git a/coverage/tracer.c b/coverage/tracer.c index fe40fc6..875bfea 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; -- cgit v1.2.1