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
ENH: resync numpy/__init__.pxd with upstream #16170
Conversation
I am pretty sure numpy.random excercises much of this |
…the GIL (according to the declarations shipped by NumPy itself). See numpy/numpy#16170
I added the same |
…es and document them (copied from NumPy docs). Adapt the 'nogil' declarations according to the ones in NumPy and add some missing functions. See numpy/numpy#16170
Synced in Cython. I also turned all remaining struct field declarations into properties, |
numpy/__init__.pxd
Outdated
int PyArray_INCREF (ndarray) | ||
int PyArray_XDECREF (ndarray) | ||
# int PyArray_INCREF (ndarray) | ||
# int PyArray_XDECREF (ndarray) |
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.
I'm curious about the removal of these two functions, and the two below. They are part of the API, does cython not want to use them?
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.
Correct, thanks. Reverting this change. @scoder: fyi
@@ -477,16 +470,16 @@ cdef extern from "numpy/arrayobject.h": | |||
npy_intp PyArray_REFCOUNT(object) | |||
object PyArray_ContiguousFromAny(op, int, int min_depth, int max_depth) | |||
unsigned char PyArray_EquivArrTypes(ndarray a1, ndarray a2) | |||
bint PyArray_EquivByteorders(int b1, int b2) | |||
bint PyArray_EquivByteorders(int b1, int b2) nogil | |||
object PyArray_SimpleNew(int nd, npy_intp* dims, int typenum) | |||
object PyArray_SimpleNewFromData(int nd, npy_intp* dims, int typenum, void* data) | |||
#object PyArray_SimpleNewFromDescr(int nd, npy_intp* dims, dtype descr) |
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 remove this?
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.
Or rather, why was it removed previously.
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.
OK, I see that there a lot of these commented out without comment. It would be nice to know why, but that is not something for this PR.
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.
I can't say. The git history says Update numpy.pxd
when these were added :)
Feel free to uncomment them, then we should follow in Cython. (Happy to receive a PR :) )
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.
Just to expand a bit on the comments above: this file was copied from Cython, where the functions were already commented out (the few I checked were last touched in 2009).
Let's put this in. It would be nice to hear back from @scoder, but I don't think we need to wait. Thanks Matti. |
As part of the fall-out of gh-16162, @scoder suggested we remove the buffer protocol shims from our
__init__.pxd
. As long as I was touching it, I addednogil
to the macros and removed a few non-public functions.