-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Fix: Treat Generic classes as not being is_list_like #49736
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
Isn't python 3.11 exhibiting the correct behavior? |
No, see the example in #49649 . It is preventing subclassing I think what happened here is that python 3.11 added an |
Ah OK thanks for the explanation. If you replaced |
Before seeing that message, I updated the test to more explicitly test the case of subclassing a The issue is that when you instantiate the subclass that is
Here |
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.
lgtm
Perf? |
Have to assume that the difference between doing |
I'm sure it will be small, but this is a function that we've gone out of our way to optimize to the gills |
So what's the methodology to do the comparison? In CI? Locally? And if there is a hit, then what do we do about it? |
usually show some before/after results with |
OK, so I did this test %timeit inference.is_list_like(set([1,2,3]))
572 ns ± 14.4 ns per loop (mean ± std. dev. of 7 runs, 1,000,000 loops each) AFTER %timeit inference.is_list_like(set([1,2,3]))
592 ns ± 12 ns per loop (mean ± std. dev. of 7 runs, 1,000,000 loops each) I tested a Open to other tests to try. |
thanks |
Co-authored-by: Matthew Roeschke <[email protected]>
Looks like the whatsnew note will need to move to 1.5.3 |
That's unfortunate. I was hoping this would get in to clean up some test code in |
Actually, who's responsible for creating the new 1.5.3 whatsnew template? |
I think the new whatsnew template is done at the end of the release process? cc @datapythonista |
Yes, I'll be doing it shortly, sorry for the delay. |
Maybe worth updating the branch again but otherwise lgtm to merge |
I moved the whatsnew comment from 1.5.2 to 1.5.3 in a4142ad |
Sorry looks like another merge conflict slipped in. Also the diff shows that |
Should be fixed in cb6140f |
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.
Thanks for the quick fix. I'll merge on green
Thanks @Dr-Irv |
Owee, I'm MrMeeseeks, Look at me. There seem to be a conflict, please backport manually. Here are approximate instructions:
And apply the correct labels and milestones. Congratulations — you did some good work! Hopefully your backport PR will be tested by the continuous integration and merged soon! Remember to remove the If these instructions are inaccurate, feel free to suggest an improvement. |
* Fix: Treat Generic classes as not being is_list_like * tst: update test to test subclass of DataFrame * add is_list_like test for instance of generic dataframe * combine isinstance tests * update whatsnew with clearer message * Update whatsnew to reference DataFrame as a class Co-authored-by: Matthew Roeschke <[email protected]> * fix whatsnew blank line * fix whatsnew issue quotes * move whatsnew comment from 1.5.2 to 1.5.3 Co-authored-by: Matthew Roeschke <[email protected]> (cherry picked from commit e37040a)
… being is_list_like) (#50233) * Fix: Treat Generic classes as not being is_list_like (#49736) * Fix: Treat Generic classes as not being is_list_like * tst: update test to test subclass of DataFrame * add is_list_like test for instance of generic dataframe * combine isinstance tests * update whatsnew with clearer message * Update whatsnew to reference DataFrame as a class Co-authored-by: Matthew Roeschke <[email protected]> * fix whatsnew blank line * fix whatsnew issue quotes * move whatsnew comment from 1.5.2 to 1.5.3 Co-authored-by: Matthew Roeschke <[email protected]> (cherry picked from commit e37040a) * Force checks * put back import warnings in lib.pyx - got deleted when merged
tests/dtypes/test_inference.py:test_is_list_like_generic
doc/source/whatsnew/v1.5.2.rst
file if fixing a bug or adding a new feature.