--- rpm-4.4.2/python/rpmts-py.c 2005-02-13 12:12:07.000000000 +0900 +++ rpm-4.4.2.1/python/rpmts-py.c 2007-07-05 21:24:36.000000000 +0900 @@ -224,6 +224,7 @@ char * how = "u"; /* XXX default to upgrade element if missing */ int isUpgrade = 0; char * kwlist[] = {"header", "key", "how", NULL}; + int rc = 0; if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!O|s:AddInstall", kwlist, &hdr_Type, &h, &key, &how)) @@ -248,7 +249,12 @@ if (how && !strcmp(how, "a")) rpmtsAddAvailableElement(s->ts, hdrGetHeader(h), key); else - rpmtsAddInstallElement(s->ts, hdrGetHeader(h), key, isUpgrade, NULL); + rc = rpmtsAddInstallElement(s->ts, hdrGetHeader(h), key, isUpgrade, NULL); + if (rc) { + PyErr_SetString(pyrpmError, "adding package to transaction failed"); + return NULL; + } + /* This should increment the usage count for me */ if (key) @@ -1367,7 +1373,7 @@ if (Key) { /*@-branchstate@*/ - if (PyString_Check(Key)) { + if (PyString_Check(Key) || PyUnicode_Check(Key)) { key = PyString_AsString(Key); len = PyString_Size(Key); } else if (PyInt_Check(Key)) { @@ -1391,7 +1397,7 @@ } } - return rpmmi_Wrap( rpmtsInitIterator(s->ts, tag, key, len) ); + return rpmmi_Wrap( rpmtsInitIterator(s->ts, tag, key, len), (PyObject*)s); } /** \ingroup py_c