-
-
Notifications
You must be signed in to change notification settings - Fork 112
Description
For the purpose of deciding whether verify(...)
should return a list or a single result, the return line contains the following conditional:
return verify_results if self.config.expect_references > 1 else verify_results[0]
But if expect_references
is a bool
(which is allowed per the type signature) this conditional always evaluates to False
, so only the first result is returned. This makes it difficult to work with signed documents in a context where the number of references is not fixed.
Since the docstring of expect_references
states "if set to a non-integer, any number of references is accepted (otherwise a mismatch raises an error)", I don't think this is expected behaviour.
I would think replacing the above with this would result in a more intuitive return value:
return verify_results[0] if type(self.config.expect_references) is int and self.config.expect_references == 1 else verify_results
There's an argument that this is an API-breaking change, though (the test suite is also affected in at least one place).
WDYT?