Raise exception in the converter, not caller
authorPanu Matilainen <pmatilai@redhat.com>
Mon, 12 Oct 2009 12:15:39 +0000 (15:15 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Mon, 12 Oct 2009 12:15:39 +0000 (15:15 +0300)
python/header-py.c
python/rpmtd-py.c

index a064127..5ca920e 100644 (file)
@@ -468,7 +468,6 @@ static int hdr_ass_subscript(hdrObject *s, PyObject *key, PyObject *value)
     } else if (rpmtdFromPyObject(value, &td)) {
        headerPut(s->h, td, HEADERPUT_DEFAULT);
     } else {
-       PyErr_SetString(PyExc_TypeError, "rpm.td type expected");
        return -1;
     }
     return 0;
index a84cab3..1911e25 100644 (file)
@@ -206,6 +206,7 @@ int rpmtdFromPyObject(PyObject *obj, rpmtd *td)
        *td = &(((rpmtdObject *)obj)->td);
        return 1;
     } else {
+       PyErr_SetString(PyExc_TypeError, "rpm.td type expected");
        return 0;
     }
 }