-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
API: bump MAXDIMS/MAXARGS to 64 introduce NPY_AXIS_RAVEL #25149
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
Changes from all commits
fc1bb6b
af55c6b
bbc4083
6a878e3
3270231
d6840f5
a5a250f
8dddc54
56b792c
0498d8c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Lager ``NPY_MAXDIMS`` and ``NPY_MAXARGS``, ``NPY_RAVEL_AXIS`` introduced | ||
------------------------------------------------------------------------ | ||
|
||
``NPY_MAXDIMS`` is now 64, you may want to review its use. This is usually | ||
used in a stack allocation, where the increase should be safe. | ||
However, we do encourage generally to remove any use of ``NPY_MAXDIMS`` and | ||
``NPY_MAXARGS`` to eventually allow removing the constraint completely. | ||
For the conversion helper and C-API functions mirrowing Python ones such as | ||
``tale``, ``NPY_MAXDIMS`` was used to mean ``axis=None`` these must be | ||
replaced with ``NPY_RAVEL_AXIS``. See also :ref:`migration_maxdims`. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
* ``NPY_MAX_ELSIZE`` macro has been removed as it only ever reflected | ||
builtin numeric types and served no internal purpose. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Out-of-bound axis not the same as ``axis=None`` | ||
----------------------------------------------- | ||
In some cases ``axis=32`` or for concatenate any large value | ||
was the same as ``axis=None``. | ||
Except for ``concatenate`` this was deprecate. | ||
Any out of bound axis value will now error, make sure to use | ||
``axis=None``. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -182,9 +182,8 @@ cdef extern from "numpy/arrayobject.h": | |
NPY_ARRAY_UPDATE_ALL | ||
|
||
cdef enum: | ||
NPY_MAXDIMS | ||
|
||
npy_intp NPY_MAX_ELSIZE | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe a bit random, but There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this removal need a release note? Just to say that if someone was using and relying on it, it wasn't doing what they thought it did. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🤷 I doubt anyone will notice, but sure, added. |
||
NPY_MAXDIMS # 64 on NumPy 2.x and 32 on NumPy 1.x | ||
NPY_RAVEL_AXIS # Used for functions like PyArray_Mean | ||
|
||
ctypedef void (*PyArray_VectorUnaryFunc)(void *, void *, npy_intp, void *, void *) | ||
|
||
|
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.
Was the deprecation noisy for other functions? Just wondering if we might want to merely deprecate this usage for
concatenate
since that was missed in 2022.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.
It gave a deprecation warning. I briefly considered that, and think that this is ridiculously niche. IIRC, we were close to not do the deprecation warning in the other path also.
We are talking about
np.concatenate(..., axis=32)
or higher. Where the axis value cannot relate to any actual axis.This is undocumented and unless you do it accidentally (and it happens to do what you want?!) nobody should have reason to even realize it works (at least for ~15 years), I would say.