NumPy v2.5.4

v2.5.4

v2.5.4 (Oct 10, 2026)

Changed 6
  • numpy.linalg.svd and numpy.linalg.lstsq now raise for inputs containing infinities instead of returning garbage results
  • numpy.linalg.cond now handles non-finite inputs more consistently
  • MaskedArray resets a fill_value that cannot be represented in a new dtype to the default fill_value for that dtype instead of keeping a stale or out-of-range value behavior changed · inferred, marked in the notes below
  • A MaskedArray created from a masked array with a different dtype resets an unrepresentable fill_value to the default for the new dtype
  • Workaround added for an MSVC 19.51 compiler bug in the build
  • Various typing improvements and fixes
Fixed 8
  • Fixed hangs in numpy.linalg.svd and numpy.linalg.lstsq for certain inputs containing infinities with recent versions of some LAPACK implementations
  • StringDType instances with equivalent floating-point NaN sentinels now have equal hashes, so dictionary lookups and set deduplication work correctly
  • Fixed np.strings.replace truncating old and new to the length of a
  • Fixed reshape in ureduce when a kept axis has size 0
  • Fixed two possible crashes in the ufunc.accumulate implementation
  • Fixed a memory leak in legacy ArrayMethod wrapper code
  • Fixed a segfault in as_arrays() on self-referencing pyscalars
  • Fixed canonicalization and promotion of nested subarray types

1 change to check, marked in the notes below

From NumPy

NumPy 2.5.4 Release Notes

Released on 2026-10-10.

NumPy 2.5.4 is a patch release that fixes bugs discovered after the 2.5.3 release. Highlights are:

  • Many typing fixes and improvements,
  • A workaround for the MSVC 19.51 bug, see below.

This release supports Python versions 3.12-3.15.

Improvements
  • numpy.linalg.svd and numpy.linalg.lstsq now raise for inputs containing infinities instead of returning garbage results.

  • Fixed hangs in numpy.linalg.svd and numpy.linalg.lstsq for certain inputs containing infinities for recent versions of some LAPACK implementations.

  • numpy.linalg.cond now handles non-finite inputs more consistently.

(gh-32593)

StringDType hashing with NaN sentinels

StringDType instances with equivalent floating-point NaN sentinels now have equal hashes. Previously, distinct NaN objects could produce equal dtype instances with different hashes, causing dictionary lookups and set deduplication to fail.

(gh-32563)

Changes
MaskedArray resets a fill_value that cannot be represented in a new dtype

A fill_value copied from a source array is now reset to the default fill_value for the new dtype when it cannot be represented in that dtype. Previously the copied value could be stale: ufuncs that change dtype left the result holding a fill_value typed for the old dtype, which raised a TypeError only when something later validated it (such as .view()), and a floating point fill_value that overflows an integer dtype was kept as an out-of-range value together with a RuntimeWarning. Both now fall back to the default, including when a masked array is passed to MaskedArray with a different dtype. A fill_value given explicitly by the user is still validated and raises as before. This can now raise a ComplexWarning if the fill_value is complex and the new dtype is real. behavior changed · inferred

(gh-32508) (gh-32562)

Contributors

A total of 9 people contributed to this release. People with a "+" by their names contributed a patch for the first time.

  • Aniket Singh Yadav
  • Bhuvansh Kataria +
  • Charles Harris
  • Iason Krommydas
  • Joren Hammudoglu
  • Lazizbek Ergashev +
  • Nathan Goldbaum
  • Sebastian Berg
  • Yeonho Kim
Pull requests merged

A total of 17 pull requests were merged for this release.

  • #32520: MAINT: Prepare 2.5.x for further development
  • #32557: BUG: Reset an unrepresentable fill_value on a dtype change (#32508)
  • #32565: BLD: work around MSVC 19.51 bug (#32561)
  • #32600: BUG: fix np.strings.replace truncating old/new to a's
  • #32707: BUG: fix [ureduce]{#ureduce} reshape when a kept axis has size 0 (#32536)
  • #32709: BUG: fix two possible crashes in the ufunc.accumulate implementation...
  • #32710: BUG: Reset an inherited fill_value in MaskedArray.__new__ as...
  • #32711: ENH: Improvements and fixes for stringdtype hashing (#32563)
  • #32713: CI: increase ppc64le timeout to match other timeouts (#32583)
  • #32718: BUG: fix memory leak in legacy ArrayMethod wrapper code
  • #32719: BUG: check for non-finite input before calling gesdd/gelsd and...
  • #32738: BUG: fix segfault in as_arrays() on self-referencing pyscalars
  • #32741: TYP: Various typing improvements.
  • #32791: BUG: Fix canonicalization/promotion of nested subarray types...
  • #32888: MAINT: Update vendored-meson to match main.
  • #32904: TYP: Backport a number of typing updates.
  • #32956: TYP: Various typing fixes and improvements.
View original

Upgraded? How did it go?

Discussion