summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorjbj <devnull@localhost>2001-08-06 11:27:27 +0000
committerjbj <devnull@localhost>2001-08-06 11:27:27 +0000
commite699b8fab3f25912141fd1cefc1cc0375b3dd9be (patch)
tree290779dd36df0ccbd20bc365108346c5091a7086 /python
parent682c9534adb618becfa7565a4f45eea5e8f2bb2a (diff)
downloadrpm-e699b8fab3f25912141fd1cefc1cc0375b3dd9be.tar.gz
rpm-e699b8fab3f25912141fd1cefc1cc0375b3dd9be.tar.bz2
rpm-e699b8fab3f25912141fd1cefc1cc0375b3dd9be.zip
- portability: some compilers squawk at return ((void) foo()) (#50419).
- remove fdFileno() from librpmio, use inline version instead (#50420). - fix: linux find-requires needs quotes around [:blank:]. - remove /var/lib/rpm/__db* cache files if %__dbi_cdb is not configured. - python: add hiesenbug patch. CVS patchset: 5005 CVS date: 2001/08/06 11:27:27
Diffstat (limited to 'python')
-rw-r--r--python/rpmmodule.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/python/rpmmodule.c b/python/rpmmodule.c
index 356b47546..ac862d567 100644
--- a/python/rpmmodule.c
+++ b/python/rpmmodule.c
@@ -2168,23 +2168,15 @@ static void errorcb (void)
/**
*/
static PyObject * errorSetCallback (PyObject * self, PyObject * args) {
- if (errorCB != NULL) {
- Py_DECREF (errorCB);
- errorCB = NULL;
- }
-
- if (errorData != NULL) {
- Py_DECREF (errorData);
- errorData = NULL;
- }
+ PyObject *newCB = NULL, *newData = NULL;
- if (!PyArg_ParseTuple(args, "O|O", &errorCB, &errorData)) return NULL;
+ if (!PyArg_ParseTuple(args, "O|O", &newCB, &newData)) return NULL;
/* if we're getting a void*, set the error callback to this. */
/* also, we can possibly decref any python callbacks we had */
/* and set them to NULL. */
- if (PyCObject_Check (errorCB)) {
- rpmErrorSetCallback (PyCObject_AsVoidPtr(errorCB));
+ if (PyCObject_Check (newCB)) {
+ rpmErrorSetCallback (PyCObject_AsVoidPtr(newCB));
Py_XDECREF (errorCB);
Py_XDECREF (errorData);
@@ -2196,11 +2188,17 @@ static PyObject * errorSetCallback (PyObject * self, PyObject * args) {
return Py_None;
}
- if (!PyCallable_Check (errorCB)) {
+ if (!PyCallable_Check (newCB)) {
PyErr_SetString(PyExc_TypeError, "parameter must be callable");
return NULL;
}
+ Py_XDECREF(errorCB);
+ Py_XDECREF(errorData);
+
+ errorCB = newCB;
+ errorData = newData;
+
Py_INCREF (errorCB);
Py_XINCREF (errorData);