[Rpm-maint] [PATCH 09/15] Use PyBytes_ API when reading from file descriptors and for public keys

David Malcolm dmalcolm at redhat.com
Thu Oct 15 19:15:03 UTC 2009


---
 python/rpmfd-py.c      |    2 +-
 python/rpmkeyring-py.c |    2 +-
 python/rpmts-py.c      |    8 ++++----
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/python/rpmfd-py.c b/python/rpmfd-py.c
index 0d84c41..97cd100 100644
--- a/python/rpmfd-py.c
+++ b/python/rpmfd-py.c
@@ -199,7 +199,7 @@ static PyObject *rpmfd_read(rpmfdObject *s, PyObject *args, PyObject *kwds)
 	PyErr_SetString(PyExc_IOError, Fstrerror(s->fd));
 	goto exit;
     }
-    res = PyString_FromStringAndSize(buf, read);
+    res = PyBytes_FromStringAndSize(buf, read);
 
 exit:
     free(buf);
diff --git a/python/rpmkeyring-py.c b/python/rpmkeyring-py.c
index 6bb27af..d5f131e 100644
--- a/python/rpmkeyring-py.c
+++ b/python/rpmkeyring-py.c
@@ -26,7 +26,7 @@ static PyObject *rpmPubkey_new(PyTypeObject *subtype,
     if (!PyArg_ParseTupleAndKeywords(args, kwds, "S", kwlist, &key))
 	return NULL;
 
-    if (pgpParsePkts(PyString_AsString(key), &pkt, &pktlen) <= 0) {
+    if (pgpParsePkts(PyBytes_AsString(key), &pkt, &pktlen) <= 0) {
 	PyErr_SetString(PyExc_ValueError, "invalid pubkey");
 	return NULL;
     }
diff --git a/python/rpmts-py.c b/python/rpmts-py.c
index a0f4631..ef14420 100644
--- a/python/rpmts-py.c
+++ b/python/rpmts-py.c
@@ -392,8 +392,8 @@ rpmts_PgpPrtPkts(rpmtsObject * s, PyObject * args, PyObject * kwds)
     if (!PyArg_ParseTupleAndKeywords(args, kwds, "S:PgpPrtPkts", kwlist, &blob))
     	return NULL;
 
-    pkt = (unsigned char *)PyString_AsString(blob);
-    pktlen = PyString_Size(blob);
+    pkt = (unsigned char *)PyBytes_AsString(blob);
+    pktlen = PyBytes_Size(blob);
 
     rc = pgpPrtPkts(pkt, pktlen, NULL, 1);
 
@@ -413,8 +413,8 @@ rpmts_PgpImportPubkey(rpmtsObject * s, PyObject * args, PyObject * kwds)
     	    kwlist, &blob))
 	return NULL;
 
-    pkt = (unsigned char *)PyString_AsString(blob);
-    pktlen = PyString_Size(blob);
+    pkt = (unsigned char *)PyBytes_AsString(blob);
+    pktlen = PyBytes_Size(blob);
 
     rc = rpmtsImportPubkey(s->ts, pkt, pktlen);
 
-- 
1.6.2.5



More information about the Rpm-maint mailing list