Skip to content

Fix numpy 2.0 copy=False semantics change across 15 call sites - #3

Open
FlyinTeller wants to merge 1 commit into
3dem:masterfrom
FlyinTeller:fix/numpy2-copy-compat
Open

FlyinTeller wants to merge 1 commit into
3dem:masterfrom
FlyinTeller:fix/numpy2-copy-compat

Conversation

@FlyinTeller

Copy link
Copy Markdown

In numpy<2.0, np.array(x, copy=False) means "avoid a copy when possible"; in numpy>=2.0 the same call means "never copy, raise if one would be required" - a silent behavior change, not a removed symbol, so it doesn't fail until actually exercised on data that needs a copy. np.asarray(x) is numpy's documented migration-guide replacement that preserves the original <2.0 behavior exactly.

In numpy<2.0, np.array(x, copy=False) means "avoid a copy when possible";
in numpy>=2.0 the same call means "never copy, raise if one would be
required" - a silent behavior change, not a removed symbol, so it doesn't
fail until actually exercised on data that needs a copy. np.asarray(x) is
numpy's documented migration-guide replacement that preserves the original
<2.0 behavior exactly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant