-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
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
Conversation
Thanks for the PR. Reading through the issue I think the suggestion was to only use the old way for 3.5.2 and older, but should keep it for newer versions. You'd be better off just changing the original condition to if |
Codecov Report
@@ Coverage Diff @@
## master #21098 +/- ##
=======================================
Coverage 91.83% 91.83%
=======================================
Files 153 153
Lines 49497 49497
=======================================
Hits 45456 45456
Misses 4041 4041
Continue to review full report at Codecov.
|
That makes a lot more sense. I only changed the |
No I wouldn’t do that - that item is used many other places in the package so there are a lot of implications there. I meant just change the original conditional that you removed |
Noob mistake! I just made sure that the conditional statement is only applicable when |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add your example as a test
@@ -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 |
There was a problem hiding this comment.
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?
also pls add a note in the whatsnew (0.23.1) add a strings sub-section in bug fixes |
pandas/tests/test_compat.py
Outdated
|
||
|
||
def test_re_type(): | ||
import re |
There was a problem hiding this comment.
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
Should do the trick. Thanks for the guidance! |
Thanks for the quick fix! |
…andas-dev#21098) (cherry picked from commit 6cc5f23)
git diff upstream/master -u -- "*.py" | flake8 --diff
As raised in #21078, Python 3.5.4 supports the using
isinstance()
withtyping.re.Pattern
But it does not support the same method in 3.5.2.This Bugfix PR is to revert the
re_type
to be back to what it used to be before the update with the new release.