Skip to content

DEPR: deprecate / warn about raising an error in __array__ when copy=False cannot be honore #60340

Closed
@jorisvandenbossche

Description

@jorisvandenbossche

The numpy 2.0 changed the behavior of the copy keyword in __array__, and especially making copy=False to be strict (raising an error when a zero-copy numpy array is not possible).
We only adjusted pandas to update the copy handling now in #60046 (issue #57739).

But that also introduced a breaking change for anyone doing np.array(ser, copy=False) (and who hasn't updated that when updating to numpy 2.0), which historically has always worked fine and could silently give a copy anyway.

The idea would be to still include a FutureWarning about this first before raising the error (as now in main) in pandas 3.0.

See #60046 (comment) for more context

Metadata

Metadata

Assignees

Labels

Compatpandas objects compatability with Numpy or Python functions

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions