Skip to content

TSK: deprecate setting strides, dtype, and shape on arrays. #28800

@ngoldbaum

Description

@ngoldbaum

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    17 - Task39 - free-threadingPRs and issues related to support for free-threading CPython (a.k.a. no-GIL, PEP 703)

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions