Sign In

numpy

Package Overview
Dependencies
Maintainers
2
Versions
164
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

numpy - pypi Package Compare versions

Comparing version
2.4.1
to
2.4.2
+35
doc/changelog/2.4.2-changelog.rst
Contributors
============
A total of 9 people contributed to this release. People with a "+" by their
names contributed a patch for the first time.
* Charles Harris
* Daniel Tang +
* Joren Hammudoglu
* Kumar Aditya
* Matti Picus
* Nathan Goldbaum
* Ralf Gommers
* Sebastian Berg
* Vikram Kumar +
Pull requests merged
====================
A total of 12 pull requests were merged for this release.
* `#30629 <https://github.com/numpy/numpy/pull/30629>`__: MAINT: Prepare 2.4.x for further development
* `#30636 <https://github.com/numpy/numpy/pull/30636>`__: TYP: ``arange``\ : accept datetime strings
* `#30657 <https://github.com/numpy/numpy/pull/30657>`__: MAINT: avoid possible race condition by not touching ``os.environ``...
* `#30700 <https://github.com/numpy/numpy/pull/30700>`__: BUG: validate contraction axes in tensordot (#30521)
* `#30701 <https://github.com/numpy/numpy/pull/30701>`__: DOC: __array_namespace__info__: set_module not __module__ (#30679)
* `#30702 <https://github.com/numpy/numpy/pull/30702>`__: BUG: fix free-threaded PyObject layout in replace_scalar_type_names...
* `#30703 <https://github.com/numpy/numpy/pull/30703>`__: TST: fix limited API example in tests for latest Cython
* `#30709 <https://github.com/numpy/numpy/pull/30709>`__: BUG: Fix some bugs found via valgrind (#30680)
* `#30712 <https://github.com/numpy/numpy/pull/30712>`__: MAINT: replace ob_type access with Py_TYPE in PyArray_CheckExact
* `#30713 <https://github.com/numpy/numpy/pull/30713>`__: BUG: Fixup the quantile promotion fixup
* `#30736 <https://github.com/numpy/numpy/pull/30736>`__: BUG: fix thread safety of ``array_getbuffer`` (#30667)
* `#30737 <https://github.com/numpy/numpy/pull/30737>`__: backport scipy-openblas version change
.. currentmodule:: numpy
=========================
NumPy 2.4.2 Release Notes
=========================
The NumPy 2.4.2 is a patch release that fixes bugs discovered after the
2.4.1 release. Highlights are:
- Fixes memory leaks
- Updates OpenBLAS to fix hangs
This release supports Python versions 3.11-3.14
Contributors
============
A total of 9 people contributed to this release. People with a "+" by their
names contributed a patch for the first time.
* Charles Harris
* Daniel Tang +
* Joren Hammudoglu
* Kumar Aditya
* Matti Picus
* Nathan Goldbaum
* Ralf Gommers
* Sebastian Berg
* Vikram Kumar +
Pull requests merged
====================
A total of 12 pull requests were merged for this release.
* `#30629 <https://github.com/numpy/numpy/pull/30629>`__: MAINT: Prepare 2.4.x for further development
* `#30636 <https://github.com/numpy/numpy/pull/30636>`__: TYP: ``arange``\ : accept datetime strings
* `#30657 <https://github.com/numpy/numpy/pull/30657>`__: MAINT: avoid possible race condition by not touching ``os.environ``...
* `#30700 <https://github.com/numpy/numpy/pull/30700>`__: BUG: validate contraction axes in tensordot (#30521)
* `#30701 <https://github.com/numpy/numpy/pull/30701>`__: DOC: __array_namespace__info__: set_module not __module__ (#30679)
* `#30702 <https://github.com/numpy/numpy/pull/30702>`__: BUG: fix free-threaded PyObject layout in replace_scalar_type_names...
* `#30703 <https://github.com/numpy/numpy/pull/30703>`__: TST: fix limited API example in tests for latest Cython
* `#30709 <https://github.com/numpy/numpy/pull/30709>`__: BUG: Fix some bugs found via valgrind (#30680)
* `#30712 <https://github.com/numpy/numpy/pull/30712>`__: MAINT: replace ob_type access with Py_TYPE in PyArray_CheckExact
* `#30713 <https://github.com/numpy/numpy/pull/30713>`__: BUG: Fixup the quantile promotion fixup
* `#30736 <https://github.com/numpy/numpy/pull/30736>`__: BUG: fix thread safety of ``array_getbuffer`` (#30667)
* `#30737 <https://github.com/numpy/numpy/pull/30737>`__: backport scipy-openblas version change
+17
-4

@@ -5,2 +5,3 @@ import importlib

import sys
import sysconfig
from datetime import datetime

@@ -21,2 +22,5 @@

FREE_THREADED_BUILD = sysconfig.get_config_var('Py_GIL_DISABLED')
def replace_scalar_type_names():

@@ -35,6 +39,15 @@ """ Rename numpy types to use the canonical names to make sphinx behave """

PyObject._fields_ = [
('ob_refcnt', Py_ssize_t),
('ob_type', ctypes.POINTER(PyTypeObject)),
]
if not FREE_THREADED_BUILD:
PyObject._fields_ = [
('ob_refcnt', Py_ssize_t),
('ob_type', ctypes.POINTER(PyTypeObject)),
]
else:
# As of Python 3.14
PyObject._fields_ = [
('ob_refcnt_full', ctypes.c_int64),
# an anonymous struct that we don't try to model
('__private', ctypes.c_int64),
('ob_type', ctypes.POINTER(PyTypeObject)),
]

@@ -41,0 +54,0 @@ PyTypeObject._fields_ = [

@@ -8,2 +8,3 @@ *************

2.4.2 <release/2.4.2-notes>
2.4.1 <release/2.4.1-notes>

@@ -10,0 +11,0 @@ 2.4.0 <release/2.4.0-notes>

+2
-2

@@ -27,4 +27,6 @@ """

)
from numpy._utils import set_module
@set_module('numpy')
class __array_namespace_info__:

@@ -62,4 +64,2 @@ """

__module__ = 'numpy'
def capabilities(self):

@@ -66,0 +66,0 @@ """

@@ -16,5 +16,7 @@ """

env_added = []
for envkey in ['OPENBLAS_MAIN_FREE', 'GOTOBLAS_MAIN_FREE']:
for envkey in ['OPENBLAS_MAIN_FREE']:
if envkey not in os.environ:
os.environ[envkey] = '1'
# Note: using `putenv` (and `unsetenv` further down) instead of updating
# `os.environ` on purpose to avoid a race condition, see gh-30627.
os.putenv(envkey, '1')
env_added.append(envkey)

@@ -87,3 +89,3 @@

for envkey in env_added:
del os.environ[envkey]
os.unsetenv(envkey)
del envkey

@@ -90,0 +92,0 @@ del env_added

@@ -35,3 +35,3 @@ /*

#define PyArray_Check(op) PyObject_TypeCheck(op, &PyArray_Type)
#define PyArray_CheckExact(op) (((PyObject*)(op))->ob_type == &PyArray_Type)
#define PyArray_CheckExact(op) (Py_TYPE((PyObject*)(op)) == &PyArray_Type)

@@ -38,0 +38,0 @@ #define PyArray_HasArrayInterfaceType(op, type, context, out) \

@@ -75,2 +75,3 @@ # TODO: Sort out any and all missing functions in this namespace

_ArrayLikeUInt_co,
_DT64Codes,
_DTypeLike,

@@ -1045,7 +1046,18 @@ _FloatLike_co,

) -> _Array1D[np.datetime64[Incomplete]]: ...
@overload # (str, str, timedelta-like, dtype=dt64-like) (requires both start and stop)
def arange(
start_or_stop: str,
/,
stop: str,
step: _TD64Like_co | None = 1,
*,
dtype: _DTypeLike[np.datetime64] | _DT64Codes,
device: L["cpu"] | None = None,
like: _SupportsArrayFunc | None = None,
) -> _Array1D[np.datetime64[Incomplete]]: ...
@overload # dtype=<unknown>
def arange(
start_or_stop: _ArangeScalar | float,
start_or_stop: _ArangeScalar | float | str,
/,
stop: _ArangeScalar | float | None = None,
stop: _ArangeScalar | float | str | None = None,
step: _ArangeScalar | float | None = 1,

@@ -1052,0 +1064,0 @@ *,

@@ -796,4 +796,6 @@ #define NPY_NO_DEPRECATED_API NPY_API_VERSION

/* Fill in information (and add it to _buffer_info if necessary) */
Py_BEGIN_CRITICAL_SECTION(self);
info = _buffer_get_info(
&((PyArrayObject_fields *)self)->_buffer_info, obj, flags);
Py_END_CRITICAL_SECTION();
if (info == NULL) {

@@ -884,3 +886,6 @@ goto fail;

*/
_buffer_info_t *info = _buffer_get_info(&scalar->_buffer_info, self, flags);
_buffer_info_t *info = NULL;
Py_BEGIN_CRITICAL_SECTION(scalar);
info = _buffer_get_info(&scalar->_buffer_info, self, flags);
Py_END_CRITICAL_SECTION();
if (info == NULL) {

@@ -887,0 +892,0 @@ Py_DECREF(self);

@@ -127,3 +127,3 @@ /*

int aligned = PyArray_ISALIGNED(arr);
if (PyArray_ISCONTIGUOUS(arr)) {
if (PyArray_ISCONTIGUOUS(arr) || PyArray_IS_F_CONTIGUOUS(arr)) {
return PyArray_ClearBuffer(

@@ -156,2 +156,3 @@ descr, PyArray_BYTES(arr), descr->elsize,

data_it, inner_shape, inner_stride, clear_info.auxdata) < 0) {
NPY_traverse_info_xfree(&clear_info);
return -1;

@@ -161,2 +162,3 @@ }

shape_it, data_it, strides_it);
NPY_traverse_info_xfree(&clear_info);
return 0;

@@ -163,0 +165,0 @@ }

@@ -511,5 +511,7 @@ #define NPY_NO_DEPRECATED_API NPY_API_VERSION

if (unique_funcs.find(type) == unique_funcs.end()) {
Py_RETURN_NOTIMPLEMENTED;
result = Py_NewRef(Py_NotImplemented);
}
result = unique_funcs[type](arr, equal_nan);
else {
result = unique_funcs[type](arr, equal_nan);
}
}

@@ -516,0 +518,0 @@ catch (const std::bad_alloc &e) {

@@ -251,2 +251,3 @@ #cython: language_level=3

cnp.NpyIter_GetIterNext(cit, NULL)
cnp.NpyIter_Deallocate(cit)
return 1

@@ -253,0 +254,0 @@

@@ -1,3 +0,1 @@

#define Py_LIMITED_API 0x03060000
#include <Python.h>

@@ -4,0 +2,0 @@ #include <numpy/arrayobject.h>

@@ -0,5 +1,7 @@

import sys
import pytest
import numpy as np
from numpy.testing import assert_array_equal
from numpy.testing import HAS_REFCOUNT, assert_array_equal

@@ -76,1 +78,19 @@

assert type(arr.__array_wrap__(arr1d, None, True)) is type(arr)
@pytest.mark.skipif(not HAS_REFCOUNT, reason="Python lacks refcounts")
def test_cleanup_with_refs_non_contig():
# Regression test, leaked the dtype (but also good for rest)
dtype = np.dtype("O,i")
obj = object()
expected_ref_dtype = sys.getrefcount(dtype)
expected_ref_obj = sys.getrefcount(obj)
proto = np.full((3, 4, 5, 6, 7), np.array((obj, 2), dtype=dtype))
# Give array a non-trivial order to exercise more cleanup paths.
arr = proto.transpose((2, 0, 3, 1, 4)).copy("K")
del proto, arr
actual_ref_dtype = sys.getrefcount(dtype)
actual_ref_obj = sys.getrefcount(obj)
assert actual_ref_dtype == expected_ref_dtype
assert actual_ref_obj == actual_ref_dtype
import concurrent.futures
import sys
import threading

@@ -378,1 +379,29 @@

b.abort()
@pytest.mark.skipif(sys.version_info < (3, 12), reason="Python >= 3.12 required")
def test_array__buffer__thread_safety():
import inspect
arr = np.arange(1000)
flags = [inspect.BufferFlags.STRIDED, inspect.BufferFlags.READ]
def func(b):
b.wait()
for i in range(100):
arr.__buffer__(flags[i % 2])
run_threaded(func, max_workers=8, pass_barrier=True)
@pytest.mark.skipif(sys.version_info < (3, 12), reason="Python >= 3.12 required")
def test_void_dtype__buffer__thread_safety():
import inspect
dt = np.dtype([('name', np.str_, 16), ('grades', np.float64, (2,))])
x = np.array(('ndarray_scalar', (1.2, 3.0)), dtype=dt)[()]
assert isinstance(x, np.void)
flags = [inspect.BufferFlags.STRIDES, inspect.BufferFlags.READ]
def func(b):
b.wait()
for i in range(100):
x.__buffer__(flags[i % 2])
run_threaded(func, max_workers=8, pass_barrier=True)

@@ -135,2 +135,4 @@ import sys

assert_type(np.arange(0, 10, dtype="f8"), np.ndarray[tuple[int], np.dtype])
# https://github.com/numpy/numpy/issues/30628
assert_type(np.arange("2025-12-20", "2025-12-23", dtype="datetime64[D]"), np.ndarray[tuple[int], np.dtype[np.datetime64[Any]]])

@@ -137,0 +139,0 @@ assert_type(np.require(A), npt.NDArray[np.float64])

@@ -5,8 +5,8 @@

"""
version = "2.4.1"
version = "2.4.2"
__version__ = version
full_version = version
git_revision = "d24bb7f48d3b0e3471c68f1309c130d0b65ee72a"
git_revision = "c81c49f77451340651a751e76bca607d85e4fd55"
release = 'dev' not in version and '+' not in version
short_version = version.split("+")[0]
Metadata-Version: 2.4
Name: numpy
Version: 2.4.1
Version: 2.4.2
Summary: Fundamental package for array computing in Python

@@ -5,0 +5,0 @@ Author: Travis E. Oliphant et al.

@@ -10,3 +10,3 @@ [build-system]

name = "numpy"
version = "2.4.1"
version = "2.4.2"
description = "Fundamental package for array computing in Python"

@@ -13,0 +13,0 @@ authors = [{name = "Travis E. Oliphant et al."}]

@@ -1,4 +0,4 @@

spin==0.15
spin
# Keep this in sync with ci32_requirements.txt
scipy-openblas32==0.3.30.0.7
scipy-openblas64==0.3.30.0.7
scipy-openblas32==0.3.31.22.0
scipy-openblas64==0.3.31.22.0

@@ -1,3 +0,3 @@

spin==0.15
spin
# Keep this in sync with ci_requirements.txt
scipy-openblas32==0.3.30.0.7
scipy-openblas32==0.3.31.22.0

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display