PyObject_CallFunction(fn, discard_const_p(char, "(i,O)"), level, PyString_FromFormatV(fmt, ap));
}
+static PyObject *py_ldb_debug_func;
+
static PyObject *py_ldb_set_debug(PyObject *self, PyObject *args)
{
PyObject *cb;
if (!PyArg_ParseTuple(args, "O", &cb))
return NULL;
+ if (py_ldb_debug_func != NULL) {
+ Py_DECREF(py_ldb_debug_func);
+ }
+
Py_INCREF(cb);
- /* FIXME: Where do we DECREF cb ? */
+ /* FIXME: DECREF cb when exiting program */
+ py_ldb_debug_func = cb;
ldb_ctx = pyldb_Ldb_AsLdbContext(self);
PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError,
ldb_set_debug(ldb_ctx, py_ldb_debug, cb),