Skip to content

Commit 6cc5f23

Browse files
adamabkTomAugspurger
authored andcommitted
BUG: type aliasing is not allowed to be compared using isinstance() (#21098)
1 parent d623ffd commit 6cc5f23

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

doc/source/whatsnew/v0.23.1.txt

+5
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ Groupby/Resample/Rolling
4848
^^^^^^^^^^^^^^^^^^^^^^^^
4949

5050
- Bug in :func:`DataFrame.agg` where applying multiple aggregation functions to a :class:`DataFrame` with duplicated column names would cause a stack overflow (:issue:`21063`)
51+
52+
Strings
53+
^^^^^^^
54+
55+
- Bug in :meth:`Series.str.replace()` where the method throws `TypeError` on Python 3.5.2 (:issue: `21078`)
5156
-
5257

5358
Conversion

pandas/compat/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ def raise_with_traceback(exc, traceback=Ellipsis):
425425

426426
# In Python 3.7, the private re._pattern_type is removed.
427427
# Python 3.5+ have typing.re.Pattern
428-
if PY35:
428+
if PY36:
429429
import typing
430430
re_type = typing.re.Pattern
431431
else:

pandas/tests/test_compat.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
"""
55

66
import pytest
7+
import re
78
from pandas.compat import (range, zip, map, filter, lrange, lzip, lmap,
89
lfilter, builtins, iterkeys, itervalues, iteritems,
9-
next, get_range_parameters, PY2)
10+
next, get_range_parameters, PY2, re_type)
1011

1112

1213
class TestBuiltinIterators(object):
@@ -89,3 +90,7 @@ def test_get_range_parameters(self, start, stop, step):
8990
assert start_result == start_expected
9091
assert stop_result == stop_expected
9192
assert step_result == step_expected
93+
94+
95+
def test_re_type():
96+
assert isinstance(re.compile(''), re_type)

0 commit comments

Comments
 (0)