From dd602092fb2dadab1f20b9f0e8baa1cca0b1c0ae Mon Sep 17 00:00:00 2001 From: jorenham Date: Wed, 24 Dec 2025 11:49:22 +0100 Subject: [PATCH 1/3] =?UTF-8?q?=F0=9F=91=BD=EF=B8=8F=20`ndarray.strides.fs?= =?UTF-8?q?et`=20pending=20deprecation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/numpy-stubs/__init__.pyi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/numpy-stubs/__init__.pyi b/src/numpy-stubs/__init__.pyi index 8708379f..4ce82244 100644 --- a/src/numpy-stubs/__init__.pyi +++ b/src/numpy-stubs/__init__.pyi @@ -27,7 +27,7 @@ from typing import ( overload, type_check_only, ) -from typing_extensions import Buffer, CapsuleType, Protocol, TypeVar, override +from typing_extensions import Buffer, CapsuleType, Protocol, TypeVar, deprecated, override import _numtype as _nt @@ -1724,6 +1724,7 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DTypeT_co]): @property def strides(self) -> tuple[int, ...]: ... @strides.setter + @deprecated("Setting the strides on a NumPy array has been deprecated in NumPy 2.4") def strides(self, value: tuple[int, ...], /) -> None: ... # From 20fe490e59afe109586de6495a5ca8be28c7c182 Mon Sep 17 00:00:00 2001 From: jorenham Date: Wed, 24 Dec 2025 11:49:38 +0100 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=91=BD=EF=B8=8F=20`ndarray.shape.fset?= =?UTF-8?q?`=20pending=20deprecation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/numpy-stubs/__init__.pyi | 1 + 1 file changed, 1 insertion(+) diff --git a/src/numpy-stubs/__init__.pyi b/src/numpy-stubs/__init__.pyi index 4ce82244..1bbc4627 100644 --- a/src/numpy-stubs/__init__.pyi +++ b/src/numpy-stubs/__init__.pyi @@ -1718,6 +1718,7 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DTypeT_co]): # def shape(self: _nt.HasInnerShape[_ShapeT] | ndarray[_ShapeT2]) -> _ShapeT | _ShapeT2: ... # noqa: ERA001 def shape(self: ndarray[_AnyShapeT]) -> _AnyShapeT: ... @shape.setter + @deprecated("In-place shape modification will be deprecated in NumPy 2.5.", category=PendingDeprecationWarning) def shape(self: _nt.HasInnerShape[_ShapeT] | ndarray[_ShapeT2], shape: _ShapeT | _ShapeT2, /) -> None: ... # From c52e0d7770e6733efd94e52644d8c976f4bdb285 Mon Sep 17 00:00:00 2001 From: jorenham Date: Wed, 24 Dec 2025 11:56:14 +0100 Subject: [PATCH 3/3] =?UTF-8?q?=E2=9C=85=20update=20rejection=20test=20for?= =?UTF-8?q?=20the=20`ndarray.shape`=20setter?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/numpy-stubs/@test/static/reject/ma.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/numpy-stubs/@test/static/reject/ma.pyi b/src/numpy-stubs/@test/static/reject/ma.pyi index def80bbf..3e95b18c 100644 --- a/src/numpy-stubs/@test/static/reject/ma.pyi +++ b/src/numpy-stubs/@test/static/reject/ma.pyi @@ -2,7 +2,7 @@ import numpy as np m: np.ma.MaskedArray[tuple[int], np.dtype[np.float64]] -m.shape = (3, 1) # type: ignore[arg-type, assignment] +m.shape = (3, 1) # type: ignore[arg-type, assignment] # pyright: ignore[reportDeprecated] m.dtype = np.bool # type: ignore[assignment, misc] # pyright: ignore[reportAttributeAccessIssue] np.amin(m, axis=1.0) # type: ignore[call-overload] # pyright: ignore[reportArgumentType, reportCallIssue]