[Pkg-gnupg-commit] [gpgme] 76/132: python: Fix error handling.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Wed Apr 26 01:01:27 UTC 2017


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch experimental
in repository gpgme.

commit 048c5f74b61d5e4fa7617ce7c9111c6754bd4409
Author: Justus Winter <justus at g10code.com>
Date:   Thu Feb 16 14:42:17 2017 +0100

    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 at g10code.com>
---
 lang/python/gpgme.i | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lang/python/gpgme.i b/lang/python/gpgme.i
index c7fc14e..3e89bb1 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);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gpgme.git



More information about the Pkg-gnupg-commit mailing list