ENH: add getters for accessing struct fields in cython#30994
ENH: add getters for accessing struct fields in cython#30994seberg merged 12 commits intonumpy:mainfrom
Conversation
seberg
left a comment
There was a problem hiding this comment.
Thanks, this is nice. I am wondering a bit if it matters to bother with the ufunc code but probably it is just pragmatic.
(Mainly, while I could see doing something different, I can't think of a path forward short of just deleting it all and telling people to vendor a ufunc.pxd if they need it... -- but while that may even make sense, it isn't a minor relase thing.)
Co-authored-by: Sebastian Berg <sebastian@sipsolutions.net>
ngoldbaum
left a comment
There was a problem hiding this comment.
We probably need to touch the C API docs as well. Historically any time we touch the C API docs we also notice a bunch of other issues and out-of-date docs, please feel free to ping me for help on that. I did a big docs change for the StringDType C API so I know where most of the skeletons in the closet are.
I think it is too early to start working on the docs, IMO we should wait for the full implementation to land before working on docs because it is possible that we may end up removing or adding things later. |
This PR adds new C API functions so we should update the C API docs to match. It's a really minor change though, see kumaraditya303#1. |
|
Let's also add a release note for the new C API macros too. |
seberg
left a comment
There was a problem hiding this comment.
Thanks, looks good and nicer with just the struct getter. Let's see if anyone needs writeable access to the ufunc or descr in Cython.
At least the descr would make a little bit of sense, so we might need setters eventually.
But I'll doubt anyone creates new dtype objects in Cython, so it should be fine (and casting it to the struct isn't hard).
PR summary
This PR adds getters for accessing struct fields in cython. In future these would call an ABI function to get the actual fields struct on opaque PyObject builds.
See #30704
AI Disclosure
No AI tools used