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.

(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 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.