diff options
-rw-r--r-- | python/rpm/transaction.py | 3 | ||||
-rw-r--r-- | python/rpmts-py.c | 6 |
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; } |