diff --git a/tools/python/apixml2python/handwritten_definitions.mustache b/tools/python/apixml2python/handwritten_definitions.mustache index 4aab9c78d..a4b3e579f 100644 --- a/tools/python/apixml2python/handwritten_definitions.mustache +++ b/tools/python/apixml2python/handwritten_definitions.mustache @@ -104,12 +104,11 @@ static PyObject * pylinphone_module_method_set_log_handler(PyObject *self, PyObj if (!PyArg_ParseTuple(args, "O", &callback)) { return NULL; } - if (!PyCallable_Check(callback)) { - PyErr_SetString(PyExc_TypeError, "The argument must be a callable"); + if (!PyCallable_Check(callback) && (callback != Py_None)) { + PyErr_SetString(PyExc_TypeError, "The argument must be a callable or None"); return NULL; } if (linphone_module != NULL) { - Py_INCREF(callback); PyObject_SetAttrString(linphone_module, "__log_handler", callback); Py_DECREF(linphone_module); }