summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kahn Gillmor <dkg@fifthhorseman.net>2018-11-28 01:51:24 -0500
committerAndre Heinecke <aheinecke@intevation.de>2018-12-05 11:46:09 +0100
commitb8fa76a30c02afc3d7f6aad0a59bb613d1b711fc (patch)
treea3440db9deb97421086b2f9d6a4d2dac53d9131e
parent49af6d76e55f348c7b3cece756d6ac643d17ee68 (diff)
downloadgpgme-b8fa76a30c02afc3d7f6aad0a59bb613d1b711fc.tar.gz
python: gpg.Context.decrypt verify_sigs and sink_result are bools
Both of these function-internal variables are never used for anything other than a binary state. Implement them as the booleans they are. Otherwise, casual readers of the code might think that they're supposed to represent something other than a flag (e.g. "verify_sigs" could mean "the signatures to verify", and "sink_result" could mean "the place where we sink the result"). Signed-Off-By: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
-rw-r--r--lang/python/src/core.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/lang/python/src/core.py b/lang/python/src/core.py
index 0b7b7e08..87cfd6bf 100644
--- a/lang/python/src/core.py
+++ b/lang/python/src/core.py
@@ -367,8 +367,8 @@ class Context(GpgmeWrapper):
GPGMEError -- as signaled by the underlying library
"""
- sink_result = None
- verify_sigs = None
+ sink_result = False
+ verify_sigs = False
plaintext = sink if sink else Data()
if passphrase is not None:
@@ -397,7 +397,7 @@ class Context(GpgmeWrapper):
self.op_decrypt(ciphertext, plaintext)
except errors.GPGMEError as e:
result = self.op_decrypt_result()
- if verify is not None and sink_result is None:
+ if verify is not None and not sink_result:
verify_result = self.op_verify_result()
else:
verify_result = None
@@ -412,7 +412,7 @@ class Context(GpgmeWrapper):
result = self.op_decrypt_result()
- if verify is not None and sink_result is None:
+ if verify is not None and not sink_result:
verify_result = self.op_verify_result()
else:
verify_result = None
@@ -428,7 +428,7 @@ class Context(GpgmeWrapper):
for s in verify_result.signatures):
raise errors.BadSignatures(verify_result, results=results)
- if verify_sigs is not None:
+ if verify_sigs:
missing = []
for key in verify:
ok = False