8000 API: bump MAXDIMS/MAXARGS to 64 introduce NPY_AXIS_RAVEL by seberg · Pull Request #25149 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

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

Merged
merged 10 commits into from
Nov 28, 2023
Merged
Prev Previous commit
Next Next commit
Apply suggestions from code review
Co-authored-by: Nathan Goldbaum <nathan.goldbaum@gmail.com>
  • Loading branch information
seberg and ngoldbaum authored Nov 24, 2023
commit 56b792ce6d84984db8709b4a57cd794a6d02b34e
2 changes: 1 addition & 1 deletion doc/release/upcoming_changes/25149.c_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ 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 stack allocation, where the increase should be safe.
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.
In some cases, ``NPY_MAXDIMS`` was passed (and returned) to mean ``axis=None``
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make "In some cases" a little more specific? Does this only impact things that interact with numpy via the C API, or could you trigger this behavior from the python API too?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The python side places are already mentioned in the other one, but made it a bit more concrete.

Expand Down
2 changes: 1 addition & 1 deletion doc/source/numpy_2_0_migration_guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Increased maximum number of dimensions
The maximum number of dimensions (and arguments) was increased to 64, this
affects the ``NPY_MAXDIMS`` and ``NPY_MAXARGS`` macros.
It may be good to review their use, and we generally encourage you to
not use this macros (especially ``NPY_MAXARGS``), so that a future version of
not use these macros (especially ``NPY_MAXARGS``), so that a future version of
NumPy can remove this limitation on the number of dimensions.

``NPY_MAXDIMS`` was also used to signal ``axis=None`` in the C-API, including
Expand Down
8 changes: 4 additions & 4 deletions doc/source/reference/c-api/array.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3417,15 +3417,15 @@ Other constants
.. note::
We encourage you to avoid ``NPY_MAXDIMS``. A future version of NumPy
may wish to remove any dimension limitation (and thus the constant).
The limitation was created mainly a simplification for the liberal use
of small stack allocations as scratch space.
The limitation was created so that NumPy can use stack allocations
internally for scratch space.

If your algorithm has a reasonable maximum number of dimension you
could check and use that locally.

.. c:macro:: NPY_MAXARGS

The maximum number of array arguments that can be used in in some
The maximum number of array arguments that can be used in some
functions. This used to be 32 before NumPy 2 and is now 64.

.. note::
Expand Down Expand Up @@ -3456,7 +3456,7 @@ Other constants
have an ``axis`` argument. This macro may be passed for ``axis=None``.

.. note::
This macro is a NumPy version dependent at runtime.
This macro is NumPy version dependent at runtime.


Miscellaneous Macros
Expand Down
0