diff --git a/tenacity/retry.py b/tenacity/retry.py index 9211631..af3d45a 100644 --- a/tenacity/retry.py +++ b/tenacity/retry.py @@ -207,7 +207,7 @@ class retry_if_exception_message(retry_if_exception): def __init__( self, message: typing.Optional[str] = None, - match: typing.Optional[str] = None, + match: typing.Union[None, str, re.Pattern] = None, ) -> None: if message and match: raise TypeError( @@ -242,7 +242,7 @@ class retry_if_not_exception_message(retry_if_exception_message): def __init__( self, message: typing.Optional[str] = None, - match: typing.Optional[str] = None, + match: typing.Union[None, str, re.Pattern] = None, ) -> None: super().__init__(message, match) # invert predicate