X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fpython.c;h=a555734fa2addd0c9d163a294c73b6243cd70590;hb=eb165c5f78c06fb424de10d45ad6e484f9e24126;hp=a682f3127d32ddfa74d2ada5e737462667b653ce;hpb=240b01025dcf6b38ccf451fbd95b3c6698853268;p=collectd.git diff --git a/src/python.c b/src/python.c index a682f312..a555734f 100644 --- a/src/python.c +++ b/src/python.c @@ -197,7 +197,7 @@ static char reg_flush_doc[] = "register_flush(callback[, data][, name]) -> ident "The callback function will be called with two or three parameters:\n" "timeout: Indicates that only data older than 'timeout' seconds is to\n" " be flushed.\n" - "id: Specifies which values are to be flushed.\n" + "id: Specifies which values are to be flushed. Might be None.\n" "data: The optional data parameter passed to the register function.\n" " If the parameter was omitted it will be omitted here, too."; @@ -520,7 +520,12 @@ static void cpy_flush_callback(int timeout, const char *id, user_data_t *data) { PyObject *ret, *text; CPY_LOCK_THREADS - text = cpy_string_to_unicode_or_bytes(id); + if (id) { + text = cpy_string_to_unicode_or_bytes(id); + } else { + text = Py_None; + Py_INCREF(text); + } if (c->data == NULL) ret = PyObject_CallFunction(c->callback, "iN", timeout, text); /* New reference. */ else