From 600ccbe9d43e5857eb9b9925975f63d0e40286d8 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Mon, 28 Sep 2009 18:22:14 +0300 Subject: [PATCH] Require expected type in PyArg_ParseTupleAndKeywords() already --- python/rpmts-py.c | 27 +++------------------------ 1 file changed, 3 insertions(+), 24 deletions(-) diff --git a/python/rpmts-py.c b/python/rpmts-py.c index 3cb138f..59605e9 100644 --- a/python/rpmts-py.c +++ b/python/rpmts-py.c @@ -496,16 +496,9 @@ rpmts_HdrCheck(rpmtsObject * s, PyObject * args, PyObject * kwds) rpmRC rpmrc; char * kwlist[] = {"headers", NULL}; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O:HdrCheck", kwlist, &blob)) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "S:HdrCheck", kwlist, &blob)) return NULL; - if (blob == Py_None) { - Py_RETURN_NONE; - } - if (!PyString_Check(blob)) { - PyErr_SetString(pyrpmError, "hdrCheck takes a string of octets"); - return result; - } uh = PyString_AsString(blob); uc = PyString_Size(blob); @@ -581,16 +574,9 @@ rpmts_PgpPrtPkts(rpmtsObject * s, PyObject * args, PyObject * kwds) int rc; char * kwlist[] = {"octets", NULL}; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O:PgpPrtPkts", kwlist, &blob)) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "S:PgpPrtPkts", kwlist, &blob)) return NULL; - if (blob == Py_None) { - Py_RETURN_NONE; - } - if (!PyString_Check(blob)) { - PyErr_SetString(pyrpmError, "pgpPrtPkts takes a string of octets"); - return NULL; - } pkt = (unsigned char *)PyString_AsString(blob); pktlen = PyString_Size(blob); @@ -608,17 +594,10 @@ rpmts_PgpImportPubkey(rpmtsObject * s, PyObject * args, PyObject * kwds) int rc; char * kwlist[] = {"pubkey", NULL}; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O:PgpImportPubkey", + if (!PyArg_ParseTupleAndKeywords(args, kwds, "S:PgpImportPubkey", kwlist, &blob)) return NULL; - if (blob == Py_None) { - Py_RETURN_NONE; - } - if (!PyString_Check(blob)) { - PyErr_SetString(pyrpmError, "PgpImportPubkey takes a string of octets"); - return NULL; - } pkt = (unsigned char *)PyString_AsString(blob); pktlen = PyString_Size(blob); -- 2.7.4