diff options
Diffstat (limited to 'python/header-py.c')
-rw-r--r-- | python/header-py.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/python/header-py.c b/python/header-py.c index 45af51637..04aa96931 100644 --- a/python/header-py.c +++ b/python/header-py.c @@ -143,7 +143,7 @@ static PyObject * hdrKeyList(hdrObject * s) hi = headerInitIterator(s->h); while ((tag = headerNextTag(hi)) != RPMTAG_NOT_FOUND) { - PyObject *to = PyInt_FromLong(tag); + PyObject *to = PyLong_FromLong(tag); if (!to) { headerFreeIterator(hi); Py_DECREF(keys); @@ -231,7 +231,7 @@ static PyObject * hdrFormat(hdrObject * s, PyObject * args, PyObject * kwds) return NULL; } - result = Py_BuildValue("s", r); + result = utf8FromString(r); free(r); return result; @@ -377,7 +377,7 @@ static PyObject *hdr_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds) if (obj == NULL) { h = headerNew(); } else if (CAPSULE_CHECK(obj)) { - h = CAPSULE_EXTRACT(obj, "rpm._C_Header"); + h = CAPSULE_EXTRACT(obj, PYTHON_MODULENAME"._C_Header"); headerLink(h); } else if (hdrObject_Check(obj)) { h = headerCopy(((hdrObject*) obj)->h); @@ -415,7 +415,7 @@ static PyObject * hdr_iternext(hdrObject *s) if (s->hi == NULL) s->hi = headerInitIterator(s->h); if ((tag = headerNextTag(s->hi)) != RPMTAG_NOT_FOUND) { - res = PyInt_FromLong(tag); + res = PyLong_FromLong(tag); } else { s->hi = headerFreeIterator(s->hi); } @@ -442,9 +442,9 @@ int tagNumFromPyObject (PyObject *item, rpmTagVal *tagp) rpmTagVal tag = RPMTAG_NOT_FOUND; PyObject *str = NULL; - if (PyInt_Check(item)) { + if (PyLong_Check(item)) { /* XXX we should probably validate tag numbers too */ - tag = PyInt_AsLong(item); + tag = PyLong_AsLong(item); } else if (utf8FromPyObject(item, &str)) { tag = rpmTagGetValue(PyBytes_AsString(str)); Py_DECREF(str); @@ -483,7 +483,7 @@ static int validItem(rpmTagClass tclass, PyObject *item) switch (tclass) { case RPM_NUMERIC_CLASS: - rc = (PyLong_Check(item) || PyInt_Check(item)); + rc = (PyLong_Check(item) || PyLong_Check(item)); break; case RPM_STRING_CLASS: rc = (PyBytes_Check(item) || PyUnicode_Check(item)); @@ -532,7 +532,7 @@ static int hdrAppendItem(Header h, rpmTagVal tag, rpmTagType type, PyObject *ite case RPM_STRING_TYPE: case RPM_STRING_ARRAY_TYPE: { PyObject *str = NULL; - if (utf8FromPyObject(item, &str)) + if (utf8FromPyObject(item, &str)) rc = headerPutString(h, tag, PyBytes_AsString(str)); Py_XDECREF(str); } break; @@ -542,20 +542,20 @@ static int hdrAppendItem(Header h, rpmTagVal tag, rpmTagType type, PyObject *ite rc = headerPutBin(h, tag, val, len); } break; case RPM_INT64_TYPE: { - uint64_t val = PyInt_AsUnsignedLongLongMask(item); + uint64_t val = PyLong_AsUnsignedLongLongMask(item); rc = headerPutUint64(h, tag, &val, 1); } break; case RPM_INT32_TYPE: { - uint32_t val = PyInt_AsUnsignedLongMask(item); + uint32_t val = PyLong_AsUnsignedLongMask(item); rc = headerPutUint32(h, tag, &val, 1); } break; case RPM_INT16_TYPE: { - uint16_t val = PyInt_AsUnsignedLongMask(item); + uint16_t val = PyLong_AsUnsignedLongMask(item); rc = headerPutUint16(h, tag, &val, 1); } break; case RPM_INT8_TYPE: case RPM_CHAR_TYPE: { - uint8_t val = PyInt_AsUnsignedLongMask(item); + uint8_t val = PyLong_AsUnsignedLongMask(item); rc = headerPutUint8(h, tag, &val, 1); } break; default: @@ -718,7 +718,7 @@ static char hdr_doc[] = PyTypeObject hdr_Type = { PyVarObject_HEAD_INIT(&PyType_Type, 0) - "rpm.hdr", /* tp_name */ + PYTHON_MODULENAME".hdr", /* tp_name */ sizeof(hdrObject), /* tp_size */ 0, /* tp_itemsize */ (destructor) hdr_dealloc, /* tp_dealloc */ |