mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-02-04 12:29:27 +00:00
Fix reference count issue in the set_log_handler() method of the Python module + Allow setting its value to None.
This commit is contained in:
parent
1caa2d8de3
commit
a03227d3e2
1 changed files with 2 additions and 3 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue