ENH: Add support for the abstract scalars to cython code#17150
ENH: Add support for the abstract scalars to cython code#17150seberg merged 1 commit intonumpy:masterfrom
Conversation
This makes `isinstance` checks slightly faster
8bf63a6 to
52b4c49
Compare
This comment has been minimized.
This comment has been minimized.
|
@scoder, is the only way we can avoid writing everything twice by eventually dropping Cython < 3.0? |
|
Restarted. You need to be a member of https://dev.azure.com/numpy/numpy. If you have a user name on dev.azure.com I can add you. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
|
|
@eric-wieser I get the error "Given email address |
|
@eric-wieser The email address you got in the error message worked, you are now added. Not sure what your permissions mean... |
|
Yeah, looks like I have no permisions, but |
Take it as a nudge to drop Cython 0.x support rather sooner than later. :) You could use includes to merge multiple files into one. Question is whether you want a single source for most (but not all) of the content right now (i.e. maintain three distinct files and lose the file history when merging them back together), or whether you accept the redundancy because you prefer cleanly dropping a single file at some point when you remove Cython 0.x support. Personally, I'd go for the latter, but YMMV. |
|
When Cython3 comes out we can require it and drop the older support pretty quickly. The older one is still shipped with Cython<3, so we shouldn't be breaking anyone's workflow. |
Sorry I've lost the thread. What is this related to? |
|
|
Sorry I'm still lost |
|
Put simply: if this gets merged, can your PR be closed in your opinion? |
Maybe you are meaning to ask @jbrockmendel? |
|
Whoops, I did. Sorry for the confusion. |
|
No worries 🙂 Wasn’t sure if there was a relevant NumPy issue I had forgotten 😅 |
Quite likely. I'd like to check that performance doesn't take a hit as compared with the implementation in my PR. |
|
Could the same magic be used to make datetime64 and timedelta64 available? |
|
Yes, but let's leave that to a follow up |
|
Lets put this in, it has been sitting around for way to long and seems completely unproblematic to me. Thanks! |
Trying to follow up on this, added along with the declarations in this PR, but at import time I'm getting which is enough to stop the tests from running. Did you have something else in mind for how the followup would work? |
|
Is |
|
@jbrockmendel, you need to use |
|
When I disable and in its place put I get compile-time errors below where PyDatetimeScalarObject and PyTimedeltaScalarObject are referenced. Disabling those functions for now numpy compiles, but when running just passing instead of declaring the attributes on datetime64/timedelta64 gives the same errors. |
This makes
isinstancechecks slightly faster..This aims to replace #16363.
I'm not invested enough to go through the effort of writing the tests it would entail, but a nice follow-up for someone interested would be to add something like: