python: Fix error handling.
* lang/python/gpgme.i (typemap gpgme_key_t[]): Set an error if a non-key element is discovered. Signed-off-by: Justus Winter <justus@g10code.com>
This commit is contained in:
parent
de708e5934
commit
048c5f74b6
@ -137,7 +137,12 @@
|
|||||||
|
|
||||||
/* Following code is from swig's python.swg. */
|
/* Following code is from swig's python.swg. */
|
||||||
if ((SWIG_ConvertPtr(pypointer,(void **) &$1[i], $*1_descriptor,SWIG_POINTER_EXCEPTION | $disown )) == -1) {
|
if ((SWIG_ConvertPtr(pypointer,(void **) &$1[i], $*1_descriptor,SWIG_POINTER_EXCEPTION | $disown )) == -1) {
|
||||||
Py_DECREF(pypointer);
|
Py_DECREF(pypointer);
|
||||||
|
PyErr_Format(PyExc_TypeError,
|
||||||
|
"arg %d: list must contain only gpgme_key_ts, got %s "
|
||||||
|
"at position %d",
|
||||||
|
$argnum, pypointer->ob_type->tp_name, i);
|
||||||
|
free($1);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
Py_DECREF(pypointer);
|
Py_DECREF(pypointer);
|
||||||
|
Loading…
Reference in New Issue
Block a user