Skip to content

Commit 9a7e640

Browse files
committed
BUG: Fix Series.str.contains with compiled regex on Arrow string dtype (#61942) and add whatsnew note
1 parent 4ddc7db commit 9a7e640

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pandas/core/arrays/string_arrow.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,8 +344,10 @@ def _str_contains(
344344
na=lib.no_default,
345345
regex: bool = True,
346346
):
347-
if (isinstance(pat, re.Pattern) and regex) or flags:
347+
if flags:
348348
return super()._str_contains(pat, case, flags, na, regex)
349+
if isinstance(pat, re.pattern):
350+
pat = pat.pattern
349351

350352
return ArrowStringArrayMixin._str_contains(self, pat, case, flags, na, regex)
351353

0 commit comments

Comments
 (0)