pyopenssl
pyopenssl copied to clipboard
CRL get_revoked emits inconsistent types (NoneType vs. Tuple)
TL;DR: PR #859
CRL get_revoked emits either a None or a Tuple depending on whether there are revoked certificates. This makes for awkward syntax by the caller:
_revoked: Optional[Tuple[Any]] = crl.get_revoked()
if _revoked is not None:
for cert in _revoked:
process_revoked_cert(cert)
vs:
for cert in crl.get_revoked():
process_revoked_cert(cert)
(ends in TypeError: 'NoneType' object is not iterable)
The perception of callers is that the latter is the supported way, so I'm encountering bugs because None is not guarded against. But None doesn't belong here, IMHO