summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2009-12-17 10:38:08 +0200
committerPanu Matilainen <pmatilai@redhat.com>2009-12-17 10:38:08 +0200
commitedac0476a8ea3fbd1d86df2667a1b62d831b2653 (patch)
treed84e9a0a7a3be87c83acbba7740cf17936d09dc6 /python
parent507f21f6bb4bf7029a0bca255cfe4aae3361f358 (diff)
downloadlibrpm-tizen-edac0476a8ea3fbd1d86df2667a1b62d831b2653.tar.gz
librpm-tizen-edac0476a8ea3fbd1d86df2667a1b62d831b2653.tar.bz2
librpm-tizen-edac0476a8ea3fbd1d86df2667a1b62d831b2653.zip
Move python ts element key refcounting back to C-side of things
- it's really the C-side that needs this, doing it in C avoids nasty surprises when subclassing rpm.ts - partial revert of commit 92d18d1d7139b37065ea742cfe0e8cee5e9c3500
Diffstat (limited to 'python')
-rw-r--r--python/rpm/transaction.py3
-rw-r--r--python/rpmts-py.c6
2 files changed, 6 insertions, 3 deletions
diff --git a/python/rpm/transaction.py b/python/rpm/transaction.py
index 359d62cd3..ba8c5b007 100644
--- a/python/rpm/transaction.py
+++ b/python/rpm/transaction.py
@@ -6,8 +6,6 @@ from rpm._rpm import ts as _rpmts
# TODO: migrate relevant documentation from C-side
class TransactionSet(_rpmts):
_probFilter = 0
- # FIXME: kludge for keeping refcounts on transaction element keys
- _keyList = []
def _wrapSetGet(self, attr, val):
oval = getattr(self, attr)
@@ -62,7 +60,6 @@ class TransactionSet(_rpmts):
if not _rpmts.addInstall(self, header, key, upgrade):
raise rpm.error("adding package to transaction failed")
- self._keyList.append(key)
def addErase(self, item):
hdrs = []
diff --git a/python/rpmts-py.c b/python/rpmts-py.c
index 745b52662..72c039b6c 100644
--- a/python/rpmts-py.c
+++ b/python/rpmts-py.c
@@ -138,6 +138,7 @@ struct rpmtsObject_s {
PyObject_HEAD
PyObject *md_dict; /*!< to look like PyModuleObject */
rpmfdObject *scriptFd;
+ PyObject *keyList;
rpmts ts;
rpmtsi tsi;
};
@@ -180,6 +181,9 @@ rpmts_AddInstall(rpmtsObject * s, PyObject * args)
return NULL;
rc = rpmtsAddInstallElement(s->ts, h, key, how, NULL);
+ if (key && rc == 0) {
+ PyList_Append(s->keyList, key);
+ }
return PyBool_FromLong((rc == 0));
}
@@ -692,6 +696,7 @@ static void rpmts_dealloc(rpmtsObject * s)
s->ts = rpmtsFree(s->ts);
Py_XDECREF(s->scriptFd);
+ Py_XDECREF(s->keyList);
Py_TYPE(s)->tp_free((PyObject *)s);
}
@@ -703,6 +708,7 @@ static PyObject * rpmts_new(PyTypeObject * subtype, PyObject *args, PyObject *kw
s->ts = rpmtsCreate();
s->scriptFd = NULL;
s->tsi = NULL;
+ s->keyList = PyList_New(0);
return (PyObject *) s;
}