Improper verifying of param: "exceptions" in retry
gryznar opened this issue · comments
In function retry there is auto conversion to tuple if parametr exceptions
is instance of Exception:
if isinstance(exceptions, Exception): # pragma: no cover
exceptions = (exceptions,)
But this is improper from at least 2 reasons:
- Documentation of this param says:
"""
exceptions (tuple, optional): Tuple of exceptions that trigger a retry attempt. Exceptions
not in the tuple will be ignored. Defaults to(Exception,)
(all exceptions).
""" <- single Exception is not mentioned here - Check itself. Should be:
if issubclass(exceptions, Exception): # pragma: no cover
exceptions = (exceptions,)
How it could be fixed:
- Fix check and update documentation to mention single exception class in possible values
OR - Remove this check and conversion
Thanks for reporting!
I opted to just remove the check/conversion since it wasn't working and not documented to work anyway.