unstale

pypi / numpy

numpy

What changed in numpy 2, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-18.

76 breaking7 security19 deprecations26 new APIs and options8 performance17 behavior and defaults5 tooling71 fixes and other

See which of these apply to your code, ranked, in your agent:

npx @unstale/cli init

@unstale/cli 0.1.1 on npm

numpy 2229 changes

Breaking changes 76

  • When a copied fill_value cannot be represented in the new dtype, it resets to that dtype’s default; explicitly supplied fill_value values are still validated and raise as before.

    2.5.4release notes

  • Raises for inputs containing infinities instead of returning garbage results, and fixes hangs for certain such inputs with recent LAPACK implementations.

    2.5.4release notes

  • Raises for inputs containing infinities instead of returning garbage results, and fixes hangs for certain such inputs with recent LAPACK implementations.

    2.5.4release notes

  • Casting a fixed-width byte string array with invalid UTF-8 to StringDType now raises TypeError instead of storing invalid bytes.

    2.5.3release notes

  • The struct is opaque for extensions targeting the free-threading-compatible stable ABI, so those extensions can no longer access its fields; the NpyString allocator API remains usable with the descriptor pointer.

    2.5.2release notes

  • The minimum supported GCC version increased from 9.3.0 to 10.3.0, affecting developers building NumPy from source.

    2.5.1release notes

  • The data type alias 'a' has been removed; use 'S' instead.

    2.5.0release notes

  • _add_newdoc_ufunc(ufunc, newdoc) has been removed; assign ufunc.__doc__ instead.

    2.5.0release notes

  • Scalars now export the interface directly and are read-only, rather than exposing an array copy through a __ref entry.

    2.5.0release notes

  • Projects building against NumPy's Cython headers now require Cython 3.0 or newer.

    2.5.0release notes

  • get_array_wrap has been removed.

    2.5.0release notes

  • Windows platforms now require a minimum MSVC 19.35 toolchain, corresponding to Visual Studio 2022 version 17.5 Preview 2 or newer.

    2.5.0release notes

  • For object arrays, imag now returns getattr(element, "imag", 0) elementwise, and the result is read-only.

    2.5.0release notes

  • For object arrays, real now returns getattr(element, "real", element) elementwise, and the result is read-only.

    2.5.0release notes

  • This function has been removed.

    2.5.0release notes

  • Non-integer inputs now raise TypeError.

    2.5.0release notes

  • The re-export of numpy.char.chararray has been removed.

    2.5.0release notes

  • Two-dimensional vectors are no longer supported.

    2.5.0release notes

  • The function now accepts only numpy.ndarray; passing a scalar type raises TypeError.

    2.5.0release notes

  • Addition, subtraction, and integer multiplication now raise OverflowError when results overflow int64 or land on the NaT sentinel.

    2.5.0release notes

  • numpy.distutils has been removed.

    2.5.0release notes

  • Passing None as dtype now raises TypeError.

    2.5.0release notes

  • Unsupported device, dtype, or excessive dimensionality now raises BufferError instead of RuntimeError.

    2.5.0release notes

  • numpy.isreal is affected by the changed object-array imag behavior because it uses arr.imag.

    2.5.0release notes

  • The alias for the standard library math module has been removed.

    2.5.0release notes

  • numpy.linalg.eig now always returns complex arrays, rather than returning values whose type depended on the eigenvalues.

    2.5.0release notes

  • numpy.linalg.eigvals now always returns complex arrays, rather than returning values whose type depended on the eigenvalues.

    2.5.0release notes

  • meshgrid now always returns a tuple, including when sparse is true and copy is false.

    2.5.0release notes

  • Errors in the BTPE sampler's Stirling-series acceptance/rejection step were corrected, so results may differ for the same seed.

    2.5.0release notes

  • Results may differ for the same seed because the BTPE sampler used internally by multinomial had errors corrected.

    2.5.0release notes

  • numpy.row_stack has been removed in favor of numpy.vstack.

    2.5.0release notes

  • Addition, subtraction, and integer multiplication now raise OverflowError when results overflow int64 or land on the NaT sentinel.

    2.5.0release notes

  • Out-of-range Python integers in x or y are no longer silently truncated; they now raise OverflowError.

    2.5.0release notes

  • The C API function now raises OverflowError rather than silently truncating out-of-range Python integers.

    2.5.0release notes

  • NumPy 2.5.0 drops support for Python 3.11; supported Python versions are 3.12–3.14.

    2.5.0release notes

  • recfromtxt and recfromcsv have been removed from numpy.lib._npyio in favor of numpy.genfromtxt.

    2.5.0release notes

  • recfromtxt and recfromcsv have been removed from numpy.lib._npyio in favor of numpy.genfromtxt.

    2.5.0release notes

  • Copies of structured arrays with identical contiguous dtypes now use memcpy, which may copy padding bytes that were previously left untouched.

    2.5.0release notes

  • Returns rank 0 for empty matrices.

    2.4.5release notes

  • Converting an array with ndim greater than zero to a scalar now raises TypeError; extract a single element first.

    2.4.0release notes

  • The default x86 baseline has been raised to x86-64-v2; builds can set it to none to support older CPUs.

    2.4.0release notes

  • The deprecated, nonfunctional disp function has been removed.

    2.4.0release notes

  • Index preparation now matches ndarray behavior, with stricter validation, corrected IndexError types, and more specific errors; some float and scalar-boolean indices are deprecated.

    2.4.0release notes

  • Sorting with kind='heapsort' now maps to kind='quicksort', potentially changing execution time or unstable argsort order.

    2.4.0release notes

  • The deprecated runtime discovery mechanism has been removed.

    2.4.0release notes

  • The undocumented get_as_parameter method was removed; use _as_parameter_ instead.

    2.4.0release notes

  • The undocumented get_data method was removed; use data instead.

    2.4.0release notes

  • The undocumented get_shape method was removed; use shape instead.

    2.4.0release notes

  • The undocumented get_strides method was removed; use strides instead.

    2.4.0release notes

  • The macro defined in npy_cpu.h has been removed.

    2.4.0release notes

  • When used, NPY_HEAPSORT is mapped to NPY_QUICKSORT.

    2.4.0release notes

  • Deleting numpy from sys.modules and importing it again now fails with ImportError because C extension modules are checked for single import per process.

    2.4.0release notes

  • Type checkers no longer accept start as a keyword argument, though runtime use remains possible.

    2.4.0release notes

  • The style parameter has been removed; arguments following it, such as formatter, are now keyword-only.

    2.4.0release notes

  • The bias argument has been removed because it had no effect.

    2.4.0release notes

  • The ddof argument has been removed because it had no effect.

    2.4.0release notes

  • The deprecated module has been removed; use numpy.fft instead.

    2.4.0release notes

  • Removed in favor of numpy.isin.

    2.4.0release notes

  • The deprecated module has been removed; use numpy.linalg instead.

    2.4.0release notes

  • The delimitor parameter has been removed; use delimiter instead.

    2.4.0release notes

  • The interpolation parameter has been removed; use method instead.

    2.4.0release notes

  • The interpolation parameter has been removed; use method instead.

    2.4.0release notes

  • Removed; use next(ndindex) instead.

    2.4.0release notes

  • The interpolation parameter has been removed; use method instead.

    2.4.0release notes

  • The interpolation parameter has been removed; use method instead.

    2.4.0release notes

  • The newshape parameter has been removed; pass the shape positionally or use shape= on newer NumPy versions.

    2.4.0release notes

  • Always returns a copy, including for integer inputs with nonnegative decimals.

    2.4.0release notes

  • The ignored fix_imports parameter has been removed.

    2.4.0release notes

  • Passing a generator directly now raises TypeError; use numpy.fromiter or Python's sum builtin.

    2.4.0release notes

  • Removed; use numpy.trapezoid or scipy.integrate functions instead.

    2.4.0release notes

  • The type alias no longer accepts None; use DTypeLike | None for optional dtype annotations.

    2.4.0release notes

  • Hash-based unique extraction speeds up string arrays substantially, but returned unique values are not guaranteed to be sorted.

    2.4.0release notes

  • Multiplication that would create an unrepresentably large string now raises OverflowError instead of MemoryError.

    2.4.0release notes

  • New x86 CPU feature group representing x86-64-v3 microarchitectures.

    2.4.0release notes

  • New x86 CPU feature group representing x86-64-v4 microarchitectures.

    2.4.0release notes

  • Negative input now raises ValueError.

    2.3.4release notes

Security 7

  • Setting an array's dtype attribute is deprecated because mutating a shared array is unsafe; use array.view(dtype=new_dtype).

    2.5.0release notes

  • Resizing an array in place is deprecated because mutating a shared array is unsafe; use np.resize instead.

    2.5.0release notes

  • Fixes a heap buffer overflow in timedelta-to-string casts.

    2.4.5release notes

  • Fixes a heap overflow in fixed-width string multiplication.

    2.4.1release notes

  • Setting the strides attribute is deprecated because mutating a shared array is unsafe; create a new view instead.

    2.4.0release notes

  • Setting an array's shape attribute is deprecated; use np.reshape or np.ndarray.reshape to create a new view.

    2.4.0release notesrelease notes

  • Avoids a segmentation fault in string_expandtabs_length_promoter.

    2.3.4release notes

Deprecations 19

  • The numpy.char.array and numpy.char.asarray functions are deprecated; use numpy.array or numpy.asarray with a string or bytes dtype.

    2.5.0release notes

  • This class is deprecated; use an ndarray with a string or bytes dtype instead.

    2.5.0release notes

  • numpy.ma.round_ is deprecated; use numpy.ma.round instead.

    2.5.0release notes

  • The same-kind cast check now tests whether the result can be cast to out; a DeprecationWarning is issued when it cannot.

    2.5.0release notes

  • Using the generic unit is deprecated, as are operations that implicitly rely on it; specify an explicit unit instead.

    2.5.0release notes

  • Non-integer values for M, k, and N are deprecated.

    2.5.0release notes

  • Non-integer values for k are deprecated.

    2.5.0release notes

  • Inputs other than integers are deprecated.

    2.5.0release notes

  • Non-integer values for k are deprecated.

    2.5.0release notes

  • Inputs other than integers are deprecated.

    2.5.0release notes

  • numpy.typename is deprecated because its returned names were outdated and inconsistent; use numpy.dtype.name instead.

    2.5.0release notes

  • A VisibleDeprecationWarning is emitted when align is not a boolean; pass align as a keyword argument.

    2.4.0release notes

  • numpy.fix is deprecated; use numpy.trunc, which provides identical functionality and follows the Array API standard.

    2.4.0release notesrelease notes

  • The container class is deprecated and will be removed in a future version.

    2.4.0release notes

  • Passing out positionally is deprecated; pass it by keyword to distinguish the output buffer from inputs.

    2.4.0release notes

  • Passing out positionally is deprecated; pass it by keyword to distinguish the output buffer from inputs.

    2.4.0release notes

  • Deprecated in favor of warnings.catch_warnings, warnings.filterwarnings, pytest.warns, or pytest.filterwarnings.

    2.4.0release notes

  • Deprecated in favor of warnings.catch_warnings, warnings.filterwarnings, pytest.warns, or pytest.filterwarnings.

    2.4.0release notes

  • Calling a ufunc with where but without out now emits a warning; out=None suppresses it.

    2.4.0release notes

New APIs and options 26

  • A new polynomial function evaluates polynomials in arbitrary dimensions.

    2.5.0release notes

  • A new polynomial function evaluates polynomials in arbitrary dimensions.

    2.5.0release notes

  • A new polynomial function evaluates polynomials in arbitrary dimensions.

    2.5.0release notes

  • A new polynomial function evaluates polynomials in arbitrary dimensions.

    2.5.0release notes

  • A new polynomial function evaluates polynomials in arbitrary dimensions.

    2.5.0release notes

  • The descending keyword enables descending argsorts; NaNs remain at the end, and the feature supports built-in dtypes except void, object, and generic.

    2.5.0release notes

  • User-dtype authors can register dtypes for DLPack export and import.

    2.5.0release notes

  • The descending keyword enables descending sorts; NaNs remain at the end, and the feature supports built-in dtypes except void, object, and generic.

    2.5.0release notes

  • A new polynomial function evaluates polynomials in arbitrary dimensions.

    2.5.0release notes

  • A new C API accessor macro allows accessing a PyArray_Descr field without direct field access.

    2.5.0release notes

  • A new C API accessor macro allows accessing a PyArray_Descr field without direct field access.

    2.5.0release notes

  • A new C API accessor macro allows accessing a PyArray_Descr field without direct field access.

    2.5.0release notes

  • A new C API accessor macro allows accessing a PyArray_Descr field without direct field access.

    2.5.0release notes

  • User-defined dtypes can implement custom sorting and argsorting with ArrayMethod specs registered through PyUFunc_AddLoopsFromSpecs.

    2.4.0release notes

  • The same_value casting option verifies that values round-trip without changing; it raises ValueError if casting changes any value.

    2.4.0release notes

  • New DType API slot lets dtype implementations provide constants such as machine limits and special values, enabling numpy.finfo support.

    2.4.0release notes

  • New NPY_SORTKIND enum name for default sorting, with the same value as NPY_QUICKSORT.

    2.4.0release notes

  • New NPY_SORTKIND enum name for descending sort; it is not yet implemented.

    2.4.0release notes

  • New NPY_SORTKIND enum name indicating that sorting must be stable.

    2.4.0release notes

  • NumPy checks this protocol when converting objects to dtypes through np.dtype or dtype arguments, allowing dtype-like objects to define conversion explicitly.

    2.4.0release notes

  • The ndmax option limits the maximum dimensions created from nested sequences, useful for preserving nested structures as object elements.

    2.4.0release notes

  • The pad_width argument now accepts a dictionary.

    2.4.0release notes

  • Accepts multiple axes.

    2.4.0release notes

  • The axis argument now accepts a sequence to trim zeros along multiple axes.

    2.4.0release notes

  • New C API function registers multiple ufunc loops from specs in one call, including sorting and argsorting loops using ArrayMethod.

    2.4.0release notes

  • New x86 CPU feature group representing x86-64-v2 microarchitectures.

    2.4.0release notes

Performance 8

  • Reductions over all axes now use a fast path for contiguous, aligned, non-object arrays with no special arguments.

    2.5.0release notes

  • Reductions over all axes now use a fast path for contiguous, aligned, non-object arrays with no special arguments.

    2.5.0release notes

  • Reductions over all axes now use a fast path for contiguous, aligned, non-object arrays with no special arguments.

    2.5.0release notes

  • Searching for multiple keys is substantially faster through batched binary search steps; single-key performance remains comparable.

    2.5.0release notes

  • Reductions over all axes now use a fast path for contiguous, aligned, non-object arrays with no special arguments.

    2.5.0release notes

  • Ufuncs scale significantly better on free-threading CPython builds through lock-free dispatch, immortal shared objects, and optimized memory allocation.

    2.5.0release notes

  • Iteration over large iteration spaces is significantly faster while preserving the original behavior and interface.

    2.4.0release notes

  • Single-input ufunc calculations on scalars are about six times faster; array performance is unchanged.

    2.4.0release notes

Behavior and default changes 17

  • NumPy now uses PyMem_RawMalloc and PyMem_RawFree instead of the system malloc and free; internal allocations can be tracked by tracemalloc.

    2.5.0release notes

  • When dtype or order correction is needed, f2py now keeps a separate corrected array and copies it back after the Fortran call; only equivalent dtype kinds are allowed.

    2.5.0release notes

  • FFT functions now support non-float64 and non-complex128 dtypes and gain preliminary shape-typing support.

    2.5.0release notes

  • Input and output dtypes are more precise, and several functions gain preliminary, backward-compatible shape-typing support.

    2.5.0release notes

  • ndarray and its subclasses now support structural pattern matching with match/case statements.

    2.5.0release notes

  • The function now returns the full dtype descriptor, including parameters, for scalars of user-defined parametric data types.

    2.5.0release notes

  • This C API can now register real and imag ArrayMethods for use by imag and real.

    2.5.0release notes

  • Subclasses with dtype-specific logic should set _set_dtype to None to have arr.view(dtype=new_dtype) call __array_finalize__ with the new dtype, or define a function calling ndarray._set_dtype().

    2.5.0release notes

  • NumPy now supports the stable ABI for free-threaded Python.

    2.5.0release notes

  • Typing now accepts NumPy scalars and arrays as the second argument.

    2.4.5release notes

  • Accepts datetime strings.

    2.4.2release notes

  • The default parameter can accept array-like values.

    2.4.1release notes

  • The array interface accepts NULL data pointers and performs a dummy allocation; omit the data field to use the previous scalar path.

    2.4.0release notes

  • Assertion failure messages now include the indices at which the comparison fails.

    2.4.0release notes

  • The repr of NaT values now includes the datetime64 time unit.

    2.4.0release notes

  • Masked arrays accept and preserve Python strings as fill_value with variable-width StringDType, including through slicing and views; the default is N/A.

    2.4.0release notes

  • Hash-based unique extraction now supports complex dtypes and can return unsorted results.

    2.4.0release notes

Tooling 5

  • The module now has typing annotations across masked arrays, masks, functions, and methods.

    2.5.0release notes

  • Many functions and methods now have shape-aware return annotations, allowing type-checkers to infer result array dimensions for common operations.

    2.5.0release notes

  • On win-arm64, the library file extension is now .lib instead of .a for MSVC and setuptools compatibility.

    2.4.0release notes

  • On win-arm64, the library file extension is now .lib instead of .a for MSVC and setuptools compatibility.

    2.4.0release notes

  • On win-arm64, the npymath and npyrandom static libraries now use the .lib extension instead of .a for compatibility with MSVC and setuptools.

    2.3.4release notes

Fixes and other changes 71

  • Includes a workaround for an MSVC 19.51 bug.

    2.5.4release notes

  • Fixes truncation of the old and new strings to the length of the input array’s string.

    2.5.4release notes

  • Handles non-finite inputs more consistently.

    2.5.4release notes

  • Instances with equivalent floating-point NaN sentinels now have equal hashes, so dictionary lookups and set deduplication no longer fail because equal dtypes had different hashes.

    2.5.4release notes

  • Includes many typing fixes and improvements.

    2.5.4release notes

  • Fixes two possible crashes in the accumulate implementation.

    2.5.4release notes

  • When a dtype-changing ufunc leaves the copied fill_value invalid for the new dtype, NumPy now uses that dtype’s default fill_value instead of propagating a stale value.

    2.5.3release notes

  • Fixes the stride after removing a multi-index.

    2.5.2release notes

  • Fixes cast errors being swallowed during assignment.

    2.5.2release notes

  • Restores conjugate behavior for legacy user-defined dtypes.

    2.5.2release notes

  • Fixes a reference-count leak for overlapping copies when where is False.

    2.5.2release notes

  • Fixes corruption when reusing a StringDType.

    2.5.2release notes

  • Adds a special case for StringDType.

    2.5.2release notes

  • The release supports Python 3.15 and includes wheels for Python 3.15.0rc1.

    2.5.2release notes

  • Ensures the lock is held when accessing or writing RNG state and fully resets cached state for non-MT19937 RNGs.

    2.5.2release notes

  • Fixes the coerce flag in binary ufunc promotion.

    2.5.2release notes

  • Fixed an output-array leak in accumulate when dtype …

    2.5.1release notes

  • Corrected dtype inference for asarray([]).

    2.5.1release notes

  • The datetime Cython APIs were fixed to be compatible with older NumPy versions, helping downstream projects support those versions.

    2.5.1release notes

  • finfo is more accessible for user-defined dtypes.

    2.5.1release notes

  • Corrected the return type for object_ values.

    2.5.1release notes

  • Fixed a segfault by preventing recursive seed lists.

    2.5.1release notes

  • Fixed a typing regression introduced in NumPy 2.5.0.

    2.5.1release notes

  • Deadlocks when using the NpyString API were fixed.

    2.5.1release notes

  • Fixed an output-array leak in reduceat when dtype …

    2.5.1release notes

  • Fixed a leak in reductions when a ufunc override errors or is …

    2.5.1release notes

  • Fixed several bugs in StringDType operations.

    2.5.1release notes

  • Allocatable module variables wrapped by f2py now appear in dir() output.

    2.5.0release notes

  • numpy.triu_indices now accepts unsigned integers in all cases.

    2.5.0release notes

  • StringDType comparisons now correctly handle embedded NULL bytes.

    2.5.0release notes

  • Fixes a regression in arr.conj().

    2.4.6release notes

  • Fixes non-unitary results from np.linalg.svd(..., hermitian=True).

    2.4.6release notes

  • Fixes support for runtime type checkers.

    2.4.5release notes

  • Maps complex_long_double to NPY_CLONGDOUBLE.

    2.4.5release notes

  • Fixes typing for boolean and non-1D inputs.

    2.4.5release notes

  • Fixes in-place aliasing when out is the input.

    2.4.5release notes

  • Fixes a segfault when __getitem__ raises.

    2.4.5release notes

  • Undo the deprecation of the signature used by old pickles.

    2.4.5release notes

  • Fixes failures with a 0-dimensional out argument.

    2.4.5release notes

  • Fixes the assignability of np.shape for Python lists.

    2.4.5release notes

  • Fixes a memory leak when the fill-zero loop raises.

    2.4.5release notes

  • Prevents a deadlock caused by downstream code importing NumPy during dlopen.

    2.4.5release notes

  • Fixes typing for the axis parameter.

    2.4.5release notes

  • Fixes incorrect temporary elision for new-style user-defined dtypes.

    2.4.5release notes

  • Fixes in-place aliasing when out is the input.

    2.4.5release notes

  • Fixes 64-bit selection by using NPY_SIZEOF_UINTP.

    2.4.4release notes

  • Avoids a warning when a ufunc is called with where=True and no output.

    2.4.4release notes

  • Fixes handling of a bool array weekmask.

    2.4.3release notes

  • Fixes a weak hash function used by np.isin().

    2.4.3release notes

  • Fixes infinite recursion in np.ma.flatten_structured_array.

    2.4.3release notes

  • Adds missing extended precision imports to matlib's typing support.

    2.4.3release notes

  • Fixes the OpenBLAS threading problem on ARM.

    2.4.3release notesrelease notes

  • Fixes memory leaks discovered after the 2.4.1 release.

    2.4.2release notes

  • Updates OpenBLAS to fix hangs.

    2.4.2release notes

  • Fixes the quantile promotion fixup.

    2.4.2release notes

  • Fixes validation of contraction axes.

    2.4.2release notes

  • Fixes a leak in the flat assignment iterator.

    2.4.1release notes

  • Fixes the return type of histogram2d.

    2.4.1release notes

  • Preserves the SeedlessSequence typo so wheels using the random Cython API and built against NumPy < 2.4.0 run without errors.

    2.4.1release notes

  • Many NumPy functions, classes, and methods now return meaningful signatures instead of raising ValueError, improving introspection and tooling support.

    2.4.0release notes

  • Accuracy is improved for 16- and 32-bit floating-point input data.

    2.4.0release notes

  • Accuracy is improved for 16- and 32-bit floating-point input data.

    2.4.0release notes

  • This release supports Python versions 3.11–3.14.

    2.4.0release notesrelease notes

  • Fixed resize when the array contains references.

    2.3.5release notes

  • Fixed the implementation to avoid negating INT_MIN.

    2.3.5release notes

  • Fixed float16-sort failures on 32-bit x86 MSVC.

    2.3.4release notes

  • Fixed an assertion failure in buffer setup.

    2.3.4release notes

  • A malloc failure now emits MemoryError.

    2.3.4release notes

  • Fixed umath strides for AIX compatibility.

    2.3.4release notes

  • INT_MIN % -1 now returns 0 for all signed integer types.

    2.3.4release notes

  • Fixed negative samples generated by the Wald distribution.

    2.3.4release notes