New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DOC: Mention copy=True
for __array__
method in the migration guide.
#26097
Conversation
40394db
to
a04ed68
Compare
You need to be very careful here. Right now:
This would also significantly escalate the amount of |
EDIT: deleted a bad idea I had here originally Also would you be up for adding docs for implementers on how to handle the |
Ah this is a good point. If you run the scipy or scikit-learn tests with this PR applied, do you see a bunch of new deprecation warnings? I think I agree with Sebastian here, we’re going to explicitly pass a
The So another way to generating a bunch of new unnecessary downstream warnings or errors would be to only print the deprecation warning if someone explicitly passed in |
It occurs to me we should also update the release notes discussion for this change if we want it to be in the 2.0 release. |
I had the impression that the comment this PR is trying to address was quite minor, and non-critical for 2.0. What was critical for 2.0 was updating the docs. And then for 2.1 we can work on the change needed to ensure that there will never be two copies. Does that sound right? |
Right, I agree. The only thing that may be nice for 2.0 is adding a single half sentence to the documentation saying: However, there is something else here (should maybe make a new issue):
Gives:
Which seems wrong. It must fail (the I am not even sure we need the warning in NumPy 2.0 (i.e. this PR needs it but |
764eaa1
to
1814aa8
Compare
__array__
copy=True
for __array__
method in the migration guide.
Ok, I removed original code changes and mentioned " |
…kip cirrus] [skip actions]
4140c67
to
86b94dc
Compare
Sorry for missing this last week, let's pull this in. |
copy=True
for __array__
method in the migration guide. copy=True
for __array__
method in the migration guide.
Addresses #25941 (comment)
Hi @ngoldbaum,
With this PR, explicit
copy
argument is always passed to__array__
.NPY_ARRAY_ENSURECOPY
check was missing from flags processing, to cover all supported values forcopy
:numpy/numpy/_core/src/multiarray/ctors.c
Lines 2417 to 2420 in 7f1c8cb