Commit a03227d3 authored by Ghislain MARY's avatar Ghislain MARY
Browse files

Fix reference count issue in the set_log_handler() method of the Python module...

Fix reference count issue in the set_log_handler() method of the Python module + Allow setting its value to None.
parent 1caa2d8d
......@@ -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);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment