NumPy 2.4.0 Release Notes#
Highlights#
We’ll choose highlights for this release near the end of the release cycle.
Compatibility notes#
NumPy’s C extension modules have begun to use multi-phase initialisation, as defined by PEP 489. As part of this, a new explicit check has been added that each such module is only imported once per Python process. This comes with the side-effect that deleting
numpy
fromsys.modules
and re-importing it will now fail with anImportError
. This has always been unsafe, with unexpected side-effects, though did not previously raise an error.(gh-29030)
The Macro NPY_ALIGNMENT_REQUIRED has been removed#
The macro was defined in the npy_cpu.h file, so might be regarded as semipublic. As it turns out, with modern compilers and hardware it is almost always the case that alignment is required, so numpy no longer uses the macro. It is unlikely anyone uses it, but you might want to compile with the -Wundef flag or equivalent to be sure.
(gh-29094)
Changes#
Multiplication between a string and integer now raises OverflowError instead of MemoryError if the result of the multiplication would create a string that is too large to be represented. This follows Python’s behavior.
(gh-29060)