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);