X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fpython.c;h=e7795c751ef757fc2c97611d0838035df3b79acf;hb=9b7dee8838f56233cea2854a7ddbcad2790609ce;hp=8bcf82c28d317961f0e0e73e973c27db158480dc;hpb=9bce34a54a0e3268444a9d6d9c484f6bd566f27c;p=collectd.git diff --git a/src/python.c b/src/python.c index 8bcf82c2..e7795c75 100644 --- a/src/python.c +++ b/src/python.c @@ -302,7 +302,7 @@ void cpy_log_exception(const char *context) { Py_XDECREF(traceback); return; } - list = PyObject_CallFunction(cpy_format_exception, "NNN", type, value, traceback); /* New reference. */ + list = PyObject_CallFunction(cpy_format_exception, "NNN", type, value, traceback); /* New reference. Steals references from "type", "value" and "traceback". */ if (list) l = PyObject_Length(list); for (i = 0; i < l; ++i) { @@ -322,9 +322,6 @@ void cpy_log_exception(const char *context) { } Py_XDECREF(list); PyErr_Clear(); - Py_DECREF(type); - Py_XDECREF(value); - Py_XDECREF(traceback); } static int cpy_read_callback(user_data_t *data) { @@ -1159,8 +1156,8 @@ static int cpy_config(oconfig_item_t *ci) { cpy_log_exception("python initialization"); continue; } - if (PyList_Append(sys_path, dir_object) != 0) { - ERROR("python plugin: Unable to append \"%s\" to " + if (PyList_Insert(sys_path, 0, dir_object) != 0) { + ERROR("python plugin: Unable to prepend \"%s\" to " "python module path.", dir); cpy_log_exception("python initialization"); }