From: Sven Trenkel Date: Sun, 6 Dec 2009 18:10:19 +0000 (+0100) Subject: This should have been in the last commit. X-Git-Tag: collectd-4.9.0~35^2~8 X-Git-Url: https://git.octo.it/?a=commitdiff_plain;h=504ad9428cf1cac5571d8d94a2f61d98b2398994;p=collectd.git This should have been in the last commit. --- diff --git a/src/python.c b/src/python.c index 08abfd1d..434d931c 100644 --- a/src/python.c +++ b/src/python.c @@ -600,7 +600,13 @@ static PyObject *cpy_unregister_generic(cpy_callback_t **list_head, PyObject *ar const char *name; cpy_callback_t *prev = NULL, *tmp; - if (PyString_Check(arg)) { + if (PyUnicode_Check(arg)) { + arg = PyUnicode_AsEncodedString(arg, NULL, NULL); + if (arg == NULL) + return NULL; + name = PyString_AsString(arg); + Py_DECREF(arg); + } else if (PyString_Check(arg)) { name = PyString_AsString(arg); } else { if (!PyCallable_Check(arg)) {