Skip to content

BUG: type aliasing is not allowed to be compared using isinstance() #21098

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 17, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions doc/source/whatsnew/v0.23.1.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ Groupby/Resample/Rolling
^^^^^^^^^^^^^^^^^^^^^^^^

- 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`)

Strings
^^^^^^^

- Bug in :meth:`Series.str.replace()` where the method throws `TypeError` on Python 3.5.2
-

Conversion
Expand Down
2 changes: 1 addition & 1 deletion pandas/compat/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ def raise_with_traceback(exc, traceback=Ellipsis):

# In Python 3.7, the private re._pattern_type is removed.
# Python 3.5+ have typing.re.Pattern
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why don't we just make this >= PY36 and call it a day?

if PY35:
if PY36:
import typing
re_type = typing.re.Pattern
else:
Expand Down
7 changes: 6 additions & 1 deletion pandas/tests/test_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import pytest
from pandas.compat import (range, zip, map, filter, lrange, lzip, lmap,
lfilter, builtins, iterkeys, itervalues, iteritems,
next, get_range_parameters, PY2)
next, get_range_parameters, PY2, re_type)


class TestBuiltinIterators(object):
Expand Down Expand Up @@ -89,3 +89,8 @@ def test_get_range_parameters(self, start, stop, step):
assert start_result == start_expected
assert stop_result == stop_expected
assert step_result == step_expected


def test_re_type():
import re
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can u move the import to the top

assert isinstance(re.compile(''), re_type)