aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustus Winter <[email protected]>2017-02-16 13:42:17 +0000
committerJustus Winter <[email protected]>2017-02-16 13:42:17 +0000
commit048c5f74b61d5e4fa7617ce7c9111c6754bd4409 (patch)
treea7373054c5f63485169baaf5f1d24461d05a9cfa
parentcore: Fix expiration time handling when creating keys. (diff)
downloadgpgme-048c5f74b61d5e4fa7617ce7c9111c6754bd4409.tar.gz
gpgme-048c5f74b61d5e4fa7617ce7c9111c6754bd4409.zip
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 <[email protected]>
-rw-r--r--lang/python/gpgme.i7
1 files changed, 6 insertions, 1 deletions
diff --git a/lang/python/gpgme.i b/lang/python/gpgme.i
index c7fc14e0..3e89bb11 100644
--- a/lang/python/gpgme.i
+++ b/lang/python/gpgme.i
@@ -137,7 +137,12 @@
/* Following code is from swig's python.swg. */
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;
}
Py_DECREF(pypointer);