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:
parent
f6cd560ca7
commit
44d18200d5
@ -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);
|
||||
o = _pyme_wrap_result(fragile, "EngineInfo");
|
||||
if (o == NULL)
|
||||
if (fragile == NULL)
|
||||
{
|
||||
Py_DECREF($result);
|
||||
return NULL; /* raise */
|
||||
}
|
||||
o = _pyme_wrap_result(fragile, "EngineInfo");
|
||||
Py_DECREF(fragile);
|
||||
if (o == NULL)
|
||||
{
|
||||
Py_DECREF($result);
|
||||
return NULL; /* raise */
|
||||
}
|
||||
PyList_SetItem($result, i, o);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user