summaryrefslogtreecommitdiff
path: root/python/rpmts-py.c
diff options
context:
space:
mode:
Diffstat (limited to 'python/rpmts-py.c')
-rw-r--r--python/rpmts-py.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/python/rpmts-py.c b/python/rpmts-py.c
index 98e1c6642..d6ae23750 100644
--- a/python/rpmts-py.c
+++ b/python/rpmts-py.c
@@ -230,16 +230,17 @@ rpmts_SolveCallback(rpmts ts, rpmds ds, const void * data)
PyEval_RestoreThread(cbInfo->_save);
- args = Py_BuildValue("(Oissi)", cbInfo->tso,
- rpmdsTagN(ds), rpmdsN(ds), rpmdsEVR(ds), rpmdsFlags(ds));
- result = PyEval_CallObject(cbInfo->cb, args);
+ args = Py_BuildValue("(OiNNi)", cbInfo->tso,
+ rpmdsTagN(ds), utf8FromString(rpmdsN(ds)),
+ utf8FromString(rpmdsEVR(ds)), rpmdsFlags(ds));
+ result = PyObject_Call(cbInfo->cb, args, NULL);
Py_DECREF(args);
if (!result) {
die(cbInfo->cb);
} else {
- if (PyInt_Check(result))
- res = PyInt_AsLong(result);
+ if (PyLong_Check(result))
+ res = PyLong_AsLong(result);
Py_DECREF(result);
}
@@ -409,7 +410,7 @@ rpmts_HdrCheck(rpmtsObject * s, PyObject *obj)
rpmrc = headerCheck(s->ts, uh, uc, &msg);
Py_END_ALLOW_THREADS;
- return Py_BuildValue("(is)", rpmrc, msg);
+ return Py_BuildValue("(iN)", rpmrc, utf8FromString(msg));
}
static PyObject *
@@ -498,7 +499,7 @@ rpmtsCallback(const void * hd, const rpmCallbackType what,
/* Synthesize a python object for callback (if necessary). */
if (pkgObj == NULL) {
if (h) {
- pkgObj = Py_BuildValue("s", headerGetString(h, RPMTAG_NAME));
+ pkgObj = utf8FromString(headerGetString(h, RPMTAG_NAME));
} else {
pkgObj = Py_None;
Py_INCREF(pkgObj);
@@ -509,7 +510,7 @@ rpmtsCallback(const void * hd, const rpmCallbackType what,
PyEval_RestoreThread(cbInfo->_save);
args = Py_BuildValue("(iLLOO)", what, amount, total, pkgObj, cbInfo->data);
- result = PyEval_CallObject(cbInfo->cb, args);
+ result = PyObject_Call(cbInfo->cb, args, NULL);
Py_DECREF(args);
Py_DECREF(pkgObj);
@@ -624,8 +625,8 @@ rpmts_Match(rpmtsObject * s, PyObject * args, PyObject * kwds)
return NULL;
if (Key) {
- if (PyInt_Check(Key)) {
- lkey = PyInt_AsLong(Key);
+ if (PyLong_Check(Key)) {
+ lkey = PyLong_AsLong(Key);
key = (char *)&lkey;
len = sizeof(lkey);
} else if (PyLong_Check(Key)) {
@@ -845,7 +846,7 @@ static PyObject *rpmts_get_tid(rpmtsObject *s, void *closure)
static PyObject *rpmts_get_rootDir(rpmtsObject *s, void *closure)
{
- return Py_BuildValue("s", rpmtsRootDir(s->ts));
+ return utf8FromString(rpmtsRootDir(s->ts));
}
static int rpmts_set_scriptFd(rpmtsObject *s, PyObject *value, void *closure)
@@ -968,7 +969,7 @@ static PyGetSetDef rpmts_getseters[] = {
PyTypeObject rpmts_Type = {
PyVarObject_HEAD_INIT(&PyType_Type, 0)
- PYTHON_MODULENAME".ts", /* tp_name */
+ PYTHON_MODULENAME".ts", /* tp_name */
sizeof(rpmtsObject), /* tp_size */
0, /* tp_itemsize */
(destructor) rpmts_dealloc, /* tp_dealloc */