NumPy 2.3.0 Release Notes#
Highlights#
We’ll choose highlights for this release near the end of the release cycle.
New functions#
New function numpy.strings.slice
#
The new function numpy.strings.slice
was added, which implements fast
native slicing of string arrays. It supports the full slicing API including
negative slice offsets and steps.
(gh-27789)
Deprecations#
The
numpy.typing.mypy_plugin
has been deprecated in favor of platform-agnostic static type inference. Please removenumpy.typing.mypy_plugin
from theplugins
section of your mypy configuration. If this change results in new errors being reported, kindly open an issue.(gh-28129)
C API changes#
NpyIter_GetTransferFlags is now available to check if the iterator needs the Python API or if casts may cause floating point errors (FPE). FPEs can for example be set when casting
float64(1e300)
tofloat32
(overflow to infinity) or a NaN to an integer (invalid value).(gh-27883)
NpyIter
now has no limit on the number of operands it supports.(gh-28080)
New NpyIter_GetTransferFlags and NpyIter_IterationNeedsAPI
change#
NumPy now has the new NpyIter_GetTransferFlags function as a more precise way checking of iterator/buffering needs. I.e. whether the Python API/GIL is required or floating point errors may occur. This function is also faster if you already know your needs without buffering.
The NpyIter_IterationNeedsAPI
function now performs all the checks that were
previously performed at setup time. While it was never necessary to call it
multiple times, doing so will now have a larger cost.
(gh-27998)
Improvements#
Changes#
Changes to the main iterator and potential numerical changes#
The main iterator, used in math functions and via np.nditer
from Python
and NpyIter
in C, now behaves differently for some buffered iterations.
This means that:
The buffer size used will often be smaller than the maximum buffer sized allowed by the
buffersize
parameter.The “growinner” flag is now honored with buffered reductions when no operand requires buffering.
For np.sum()
such changes in buffersize may slightly change numerical
results of floating point operations.
Users who use “growinner” for custom reductions could notice
changes in precision (for example, in NumPy we removed it from
einsum
to avoid most precision changes and improve precision
for some 64bit floating point inputs).
(gh-27883)
The minimum supported GCC version is now 9.3.0#
The minimum supported version was updated from 8.4.0 to 9.3.0, primarily in order to reduce the chance of platform-specific bugs in old GCC versions from causing issues.
(gh-28102)