From b2f224a471fecce566443bf0f0e554de6f567f4e Mon Sep 17 00:00:00 2001 From: Jasper Spaans Date: Fri, 5 Aug 2022 11:02:44 +0900 Subject: [PATCH] python: Reset passphrase callback correctly. * lang/python/src/core.py (Context(GpgmeWrapper)): Reset passphrase callback correctly, for encrypt, decrypt, create_key, and create_subkey methods. -- Signed-off-by: Jasper Spaans --- lang/python/src/core.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/lang/python/src/core.py b/lang/python/src/core.py index 9618adcf..377b3d3a 100644 --- a/lang/python/src/core.py +++ b/lang/python/src/core.py @@ -332,8 +332,7 @@ class Context(GpgmeWrapper): finally: if passphrase is not None: self.pinentry_mode = old_pinentry_mode - if old_passphrase_cb: - self.set_passphrase_cb(*old_passphrase_cb[1:]) + gpgme.gpg_set_passphrase_cb(self, old_passphrase_cb) result = self.op_encrypt_result() assert not result.invalid_recipients @@ -426,8 +425,7 @@ class Context(GpgmeWrapper): finally: if passphrase is not None: self.pinentry_mode = old_pinentry_mode - if old_passphrase_cb: - self.set_passphrase_cb(*old_passphrase_cb[1:]) + gpgme.gpg_set_passphrase_cb(self, old_passphrase_cb) result = self.op_decrypt_result() @@ -851,8 +849,7 @@ class Context(GpgmeWrapper): finally: if util.is_a_string(passphrase): self.pinentry_mode = old_pinentry_mode - if old_passphrase_cb: - self.set_passphrase_cb(*old_passphrase_cb[1:]) + gpgme.gpg_set_passphrase_cb(self, old_passphrase_cb) return self.op_genkey_result() @@ -934,8 +931,7 @@ class Context(GpgmeWrapper): finally: if util.is_a_string(passphrase): self.pinentry_mode = old_pinentry_mode - if old_passphrase_cb: - self.set_passphrase_cb(*old_passphrase_cb[1:]) + gpgme.gpg_set_passphrase_cb(self, old_passphrase_cb) return self.op_genkey_result()