Skip to content

Commit a44271f

Browse files
fix: Add re.Pattern to allowed match types (#497)
Suggested in #436 (comment)
1 parent b4dfa3f commit a44271f

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
fixes:
3+
- |
4+
Added `re.Pattern` to allowed match types.

tenacity/retry.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ class retry_if_exception_message(retry_if_exception):
207207
def __init__(
208208
self,
209209
message: typing.Optional[str] = None,
210-
match: typing.Optional[str] = None,
210+
match: typing.Union[None, str, typing.Pattern[str]] = None,
211211
) -> None:
212212
if message and match:
213213
raise TypeError(
@@ -242,7 +242,7 @@ class retry_if_not_exception_message(retry_if_exception_message):
242242
def __init__(
243243
self,
244244
message: typing.Optional[str] = None,
245-
match: typing.Optional[str] = None,
245+
match: typing.Union[None, str, typing.Pattern[str]] = None,
246246
) -> None:
247247
super().__init__(message, match)
248248
# invert predicate

0 commit comments

Comments
 (0)