From 2f3c9ba456106cde02b4669040e4755e6ea0b8d7 Mon Sep 17 00:00:00 2001 From: snowbeta Date: Wed, 16 May 2018 23:42:53 -0400 Subject: [PATCH 1/3] BUG: type aliasing is not allowed to be compared using isinstance() --- pandas/compat/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/compat/__init__.py b/pandas/compat/__init__.py index 12517372fedd1..aae45ba3ed977 100644 --- a/pandas/compat/__init__.py +++ b/pandas/compat/__init__.py @@ -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 -if PY35: +if sys.version_info >= (3, 5, 4): import typing re_type = typing.re.Pattern else: From e2a6ea04745069971d214ee44f4b584e6fd4265b Mon Sep 17 00:00:00 2001 From: snowbeta Date: Thu, 17 May 2018 09:54:46 -0400 Subject: [PATCH 2/3] Adding test for variable. Changing the Python Version condition to PY36, Added Doc under section --- doc/source/whatsnew/v0.23.1.txt | 5 +++++ pandas/compat/__init__.py | 2 +- pandas/tests/test_compat.py | 7 ++++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/doc/source/whatsnew/v0.23.1.txt b/doc/source/whatsnew/v0.23.1.txt index 35d150dc263b8..2c86ee29632fd 100644 --- a/doc/source/whatsnew/v0.23.1.txt +++ b/doc/source/whatsnew/v0.23.1.txt @@ -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 diff --git a/pandas/compat/__init__.py b/pandas/compat/__init__.py index aae45ba3ed977..5ae22694d0da7 100644 --- a/pandas/compat/__init__.py +++ b/pandas/compat/__init__.py @@ -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 -if sys.version_info >= (3, 5, 4): +if PY36: import typing re_type = typing.re.Pattern else: diff --git a/pandas/tests/test_compat.py b/pandas/tests/test_compat.py index ead9ba1e26e2d..11864d92ad580 100644 --- a/pandas/tests/test_compat.py +++ b/pandas/tests/test_compat.py @@ -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): @@ -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 + assert isinstance(re.compile(''), re_type) From 278e67eb86600ac27080dff475e6f34209d8c05a Mon Sep 17 00:00:00 2001 From: snowbeta Date: Thu, 17 May 2018 11:28:59 -0400 Subject: [PATCH 3/3] Adding Issue number and pushing the import statement to the top --- doc/source/whatsnew/v0.23.1.txt | 2 +- pandas/tests/test_compat.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/source/whatsnew/v0.23.1.txt b/doc/source/whatsnew/v0.23.1.txt index 2c86ee29632fd..9c19d4d6bbaad 100644 --- a/doc/source/whatsnew/v0.23.1.txt +++ b/doc/source/whatsnew/v0.23.1.txt @@ -52,7 +52,7 @@ Groupby/Resample/Rolling Strings ^^^^^^^ -- Bug in :meth:`Series.str.replace()` where the method throws `TypeError` on Python 3.5.2 +- Bug in :meth:`Series.str.replace()` where the method throws `TypeError` on Python 3.5.2 (:issue: `21078`) - Conversion diff --git a/pandas/tests/test_compat.py b/pandas/tests/test_compat.py index 11864d92ad580..79d3aad493182 100644 --- a/pandas/tests/test_compat.py +++ b/pandas/tests/test_compat.py @@ -4,6 +4,7 @@ """ import pytest +import re from pandas.compat import (range, zip, map, filter, lrange, lzip, lmap, lfilter, builtins, iterkeys, itervalues, iteritems, next, get_range_parameters, PY2, re_type) @@ -92,5 +93,4 @@ def test_get_range_parameters(self, start, stop, step): def test_re_type(): - import re assert isinstance(re.compile(''), re_type)