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>
This commit is contained in:
parent
9a1903cc42
commit
30ddb2cabc
@ -367,8 +367,8 @@ class Context(GpgmeWrapper):
|
|||||||
GPGMEError -- as signaled by the underlying library
|
GPGMEError -- as signaled by the underlying library
|
||||||
|
|
||||||
"""
|
"""
|
||||||
sink_result = None
|
sink_result = False
|
||||||
verify_sigs = None
|
verify_sigs = False
|
||||||
plaintext = sink if sink else Data()
|
plaintext = sink if sink else Data()
|
||||||
|
|
||||||
if passphrase is not None:
|
if passphrase is not None:
|
||||||
@ -397,7 +397,7 @@ class Context(GpgmeWrapper):
|
|||||||
self.op_decrypt(ciphertext, plaintext)
|
self.op_decrypt(ciphertext, plaintext)
|
||||||
except errors.GPGMEError as e:
|
except errors.GPGMEError as e:
|
||||||
result = self.op_decrypt_result()
|
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()
|
verify_result = self.op_verify_result()
|
||||||
else:
|
else:
|
||||||
verify_result = None
|
verify_result = None
|
||||||
@ -412,7 +412,7 @@ class Context(GpgmeWrapper):
|
|||||||
|
|
||||||
result = self.op_decrypt_result()
|
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()
|
verify_result = self.op_verify_result()
|
||||||
else:
|
else:
|
||||||
verify_result = None
|
verify_result = None
|
||||||
@ -428,7 +428,7 @@ class Context(GpgmeWrapper):
|
|||||||
for s in verify_result.signatures):
|
for s in verify_result.signatures):
|
||||||
raise errors.BadSignatures(verify_result, results=results)
|
raise errors.BadSignatures(verify_result, results=results)
|
||||||
|
|
||||||
if verify_sigs is not None:
|
if verify_sigs:
|
||||||
missing = []
|
missing = []
|
||||||
for key in verify:
|
for key in verify:
|
||||||
ok = False
|
ok = False
|
||||||
|
Loading…
Reference in New Issue
Block a user