Skip to content

Commit 862017f

Browse files
committed
COMPAT: Remove use of private re attribute
Closes pandas-dev#20551
1 parent 1bf36b0 commit 862017f

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

pandas/compat/__init__.py

+6
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,12 @@ def raise_with_traceback(exc, traceback=Ellipsis):
423423
parse_date = _date_parser.parse
424424

425425

426+
if PY36:
427+
import typing
428+
re_type = typing.re.Pattern
429+
else:
430+
re_type = type(re.compile(''))
431+
426432
# https://github.com/pandas-dev/pandas/pull/9123
427433
def is_platform_little_endian():
428434
""" am I little endian """

pandas/core/dtypes/inference.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from collections import Iterable
77
from numbers import Number
88
from pandas.compat import (PY2, string_types, text_type,
9-
string_and_binary_types)
9+
string_and_binary_types, re_type)
1010
from pandas._libs import lib
1111

1212
is_bool = lib.is_bool
@@ -216,7 +216,7 @@ def is_re(obj):
216216
False
217217
"""
218218

219-
return isinstance(obj, re._pattern_type)
219+
return isinstance(obj, re_type)
220220

221221

222222
def is_re_compilable(obj):

0 commit comments

Comments
 (0)