Change8

v2.5.3

Breaking Changes
📦 numpyView on GitHub →
1 breaking🐛 19 fixes🔧 6 symbols

Summary

NumPy 2.5.3 is a patch release that fixes bugs discovered after the 2.5.2 release, with a focus on StringDType related issues and MaskedArray fill value handling.

⚠️ Breaking Changes

  • Casting a fixed-width byte string array (`np.bytes_`) to `StringDType` now raises `TypeError` if the bytes are not valid UTF-8. Previously, invalid bytes were stored as-is, potentially leading to undefined behavior. To fix this, ensure your byte strings are valid UTF-8 before casting.

🐛 Bug Fixes

  • Fixed a stale `_fill_value` in `MaskedArray` when ufuncs change dtype, preventing silent `TypeError` later on. Now, it falls back to the default fill value for the new dtype, potentially raising a `ComplexWarning` if complex fill values are converted to real dtypes.
  • Resolved an issue where reading into a record array with references could raise a `ValueError`.
  • Addressed uninitialized memory access and NULL-pointer dereferencing issues.
  • Fixed implicit re-exports for `np.random.{get,set}_bit_generator`.
  • Prevented assuming strides are a multiple of itemsize in `StringDType`.
  • Fixed a reference leak in `convert_from_type` for custom scalar types.
  • Addressed a number of issues around iterators and `StringDType`.
  • Avoided allocating a huge tuple of arrays in a concatenate test.
  • Prevented possible undefined behavior in 'safe' multiplication helpers.
  • Used `PyObject_` functions instead of raw `PyArray_` ones.
  • Validated UTF-8 and hardened `StringDType` bounds handling.
  • Fixed two error handling mistakes in the `StringDType` replace loop.
  • Fixed visibility annotations for functions in `StringDType`.
  • Closed duplicated file descriptors if `fdopen` fails.
  • Added missing spaces in warning and error messages.
  • Fixed error handling in `StringDType` to fixed-width bytes case.
  • Fixed a memory leak in `StringDType` creation error path.
  • Backported `StringDType` byteorder fixes.
  • Fixed a crash in `ufunc.resolve_dtypes` with a Python scalar type.

Affected Symbols