As seen in #28727, mutating arrays like this is dangerous in surprising ways, particularly on the free-threaded build.
We should guide people towards safer alternatives that create new views or copies of arrays instead of mutating.
We should first try deprecating strides and dtype, then shape, since we expect that setting shape is used the most (before np.reshape it was the only way to do it).
To do the actual deprecation, first someone needs to add the warning and deal with any fallout in the NumPy tests. Make sure the deprecation warnings indicate clearly how to update affected code. It would also be good to look at some downstream libraries like SciPy, matplotlib, pandas, and scikit-learn to see how much noise these deprecations cause in downstream tests.
If it isn't too bad and the fixes are straightforward, we should be good to go.
As seen in #28727, mutating arrays like this is dangerous in surprising ways, particularly on the free-threaded build.
We should guide people towards safer alternatives that create new views or copies of arrays instead of mutating.
We should first try deprecating
stridesanddtype, thenshape, since we expect that settingshapeis used the most (beforenp.reshapeit was the only way to do it).To do the actual deprecation, first someone needs to add the warning and deal with any fallout in the NumPy tests. Make sure the deprecation warnings indicate clearly how to update affected code. It would also be good to look at some downstream libraries like SciPy, matplotlib, pandas, and scikit-learn to see how much noise these deprecations cause in downstream tests.
If it isn't too bad and the fixes are straightforward, we should be good to go.
ndarray.resizeand thusPyArray_Resize.