python: Improve error handling.

* lang/python/gpgme.i (gpgme_engine_info_t): Improve error handling.

Signed-off-by: Justus Winter <justus@g10code.com>
This commit is contained in:
Justus Winter 2016-09-14 14:34:14 +02:00
parent f6cd560ca7
commit 44d18200d5

View File

@ -452,14 +452,24 @@
size++;
}
$result = PyList_New(size);
if ($result == NULL)
return NULL; /* raise */
for (i=0,curr=$1; i<size; i++,curr=curr->next) {
PyObject *fragile, *o;
fragile = SWIG_NewPointerObj(SWIG_as_voidptr(curr), $1_descriptor,
%newpointer_flags);
if (fragile == NULL)
{
Py_DECREF($result);
return NULL; /* raise */
}
o = _pyme_wrap_result(fragile, "EngineInfo");
if (o == NULL)
return NULL; /* raise */
Py_DECREF(fragile);
if (o == NULL)
{
Py_DECREF($result);
return NULL; /* raise */
}
PyList_SetItem($result, i, o);
}
}