summaryrefslogtreecommitdiff
path: root/python/header-py.c
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2009-10-21 13:15:44 +0300
committerPanu Matilainen <pmatilai@redhat.com>2009-10-21 13:15:44 +0300
commit1866fc41c8fdf5a82705cee7f1043d5fb634c3be (patch)
treecb5d7f68633c1083d8afe016cb5ed2d5e6230b32 /python/header-py.c
parent33c569ce6fd827ba039e36ffe0a77b0643d0ac70 (diff)
downloadrpm-1866fc41c8fdf5a82705cee7f1043d5fb634c3be.tar.gz
rpm-1866fc41c8fdf5a82705cee7f1043d5fb634c3be.tar.bz2
rpm-1866fc41c8fdf5a82705cee7f1043d5fb634c3be.zip
Replace PyString usage with PyBytes everywhere
- In Python 2.6 PyBytes is just an alias for PyString, Python 3.0 removed PyString entirely - Add compatibility defines for Python < 2.6 - Based on David Malcolm's Python 3.x efforts
Diffstat (limited to 'python/header-py.c')
-rw-r--r--python/header-py.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/python/header-py.c b/python/header-py.c
index 36543f4f1..1ea5acf87 100644
--- a/python/header-py.c
+++ b/python/header-py.c
@@ -172,7 +172,7 @@ static PyObject * hdrUnload(hdrObject * s, PyObject * args, PyObject *keywords)
return NULL;
}
- rc = PyString_FromStringAndSize(buf, len);
+ rc = PyBytes_FromStringAndSize(buf, len);
buf = _free(buf);
return rc;
@@ -372,8 +372,8 @@ static PyObject *hdr_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds)
h = headerNew();
} else if (hdrObject_Check(obj)) {
h = headerCopy(((hdrObject*) obj)->h);
- } else if (PyString_Check(obj)) {
- h = headerCopyLoad(PyString_AsString(obj));
+ } else if (PyBytes_Check(obj)) {
+ h = headerCopyLoad(PyBytes_AsString(obj));
} else if (rpmfdFromPyObject(obj, &fdo)) {
Py_BEGIN_ALLOW_THREADS;
h = headerRead(rpmfdGetFd(fdo), HEADER_MAGIC_YES);
@@ -422,8 +422,8 @@ int tagNumFromPyObject (PyObject *item, rpmTag *tagp)
if (PyInt_Check(item)) {
/* XXX we should probably validate tag numbers too */
tag = PyInt_AsLong(item);
- } else if (PyString_Check(item)) {
- tag = rpmTagGetValue(PyString_AsString(item));
+ } else if (PyBytes_Check(item)) {
+ tag = rpmTagGetValue(PyBytes_AsString(item));
} else {
PyErr_SetString(PyExc_TypeError, "expected a string or integer");
return 0;