diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2009-09-22 19:19:02 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2009-09-22 19:19:02 +0300 |
commit | da74188fa654246ec74e0375440f326e5dc714f2 (patch) | |
tree | 81ab358d268b42147278025a23e8a1c701a98c3d /python/rpmmi-py.c | |
parent | 00d683ce88748080ce78d1e2d802a401b2d30261 (diff) | |
download | librpm-tizen-da74188fa654246ec74e0375440f326e5dc714f2.tar.gz librpm-tizen-da74188fa654246ec74e0375440f326e5dc714f2.tar.bz2 librpm-tizen-da74188fa654246ec74e0375440f326e5dc714f2.zip |
Sanitize python object -> tag number exception handling
- raise exception in tagNumFromPyObject(), not in 12 different callers
- check against RPMTAG_NOT_FOUND consistently instead of -1 and whatnot
- unknown tags are value, not key or type errors
Diffstat (limited to 'python/rpmmi-py.c')
-rw-r--r-- | python/rpmmi-py.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/python/rpmmi-py.c b/python/rpmmi-py.c index 95060ab13..08b02e840 100644 --- a/python/rpmmi-py.c +++ b/python/rpmmi-py.c @@ -152,10 +152,8 @@ rpmmi_Pattern(rpmmiObject * s, PyObject * args, PyObject * kwds) &TagN, &type, &pattern)) return NULL; - if ((tag = tagNumFromPyObject (TagN)) == -1) { - PyErr_SetString(PyExc_TypeError, "unknown tag type"); - return NULL; - } + tag = tagNumFromPyObject (TagN); + if (tag == RPMTAG_NOT_FOUND) return NULL; rpmdbSetIteratorRE(s->mi, tag, type, pattern); |