[Pkg-gnupg-commit] [gpgme] 128/412: python: Fix hook.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Thu Sep 22 21:26:31 UTC 2016


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

dkg pushed a commit to branch master
in repository gpgme.

commit 283f0bdc3d32624dac93d02ba3df516e69d8d4ba
Author: Justus Winter <justus at gnupg.org>
Date:   Mon May 23 18:23:34 2016 +0200

    python: Fix hook.
    
    * lang/python/helpers.c (pyProgressCb): Fix getting hook data.
    * lang/python/tests/t-callbacks.py: Show that this works.
    
    Signed-off-by: Justus Winter <justus at gnupg.org>
---
 lang/python/helpers.c            | 2 +-
 lang/python/tests/t-callbacks.py | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/lang/python/helpers.c b/lang/python/helpers.c
index e305574..0ee24a3 100644
--- a/lang/python/helpers.c
+++ b/lang/python/helpers.c
@@ -235,7 +235,7 @@ static void pyProgressCb(void *hook, const char *what, int type, int current,
   self = PyTuple_GetItem(pyhook, 0);
   func = PyTuple_GetItem(pyhook, 1);
   if (PyTuple_Size(pyhook) == 3) {
-    dataarg = PyTuple_GetItem(pyhook, 1);
+    dataarg = PyTuple_GetItem(pyhook, 2);
     args = PyTuple_New(5);
   } else {
     args = PyTuple_New(4);
diff --git a/lang/python/tests/t-callbacks.py b/lang/python/tests/t-callbacks.py
index 13ce486..70f641d 100755
--- a/lang/python/tests/t-callbacks.py
+++ b/lang/python/tests/t-callbacks.py
@@ -91,12 +91,13 @@ Expire-Date: 2020-12-31
 
 messages = []
 def progress_cb(what, typ, current, total, hook=None):
+    assert hook == messages
     messages.append(
         "PROGRESS UPDATE: what = {}, type = {}, current = {}, total = {}"
         .format(what, typ, current, total))
 
 c = core.Context()
-c.set_progress_cb(progress_cb, None)
+c.set_progress_cb(progress_cb, messages)
 c.op_genkey(parms, None, None)
 assert len(messages) > 0
 

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