-
-
Notifications
You must be signed in to change notification settings - Fork 11.1k
ENH: Add support for copy modes to NumPy #19173
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
Changes from 1 commit
496bd1a
3a3d31b
be5823f
e16f3ff
645fadb
8538720
8c00223
4e59da1
6f0f6ac
6bff3dd
a90880a
5481a8a
f2e7a81
e828f15
1a92ae9
91d6693
7b53a02
eedb300
bc8903d
3268a48
ab01330
782d823
342e0c5
a09929b
30e3472
a6caf9c
3dcf3a9
321e028
844883c
d995ecc
0f8d4c5
698fb6d
b341e4c
781d0a7
45dbdc9
a39312c
c2acd5b
56647dd
c04509e
790f927
2677788
d9a9785
5cb2d64
8b939c9
7658ad9
2cf561b
37cd05e
9f9a348
946ab24
2c51b0a
5ede7eb
d1cb662
6c01915
5f1965f
05ff102
68dfa4b
2db65c9
d0d75f3
eccb8df
4b2cd27
84951a6
f31c4a6
dea4055
9fee0f8
f058aea
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1282,7 +1282,7 @@ _array_from_array_like(PyObject *op, | |
PyErr_Clear(); | ||
} | ||
else { | ||
tmp = _array_from_buffer_3118(memoryview); | ||
tmp = _array_from_buffer_3118(memoryview); // Assume: never creates a copy | ||
Py_DECREF(memoryview); | ||
if (tmp == NULL) { | ||
return NULL; | ||
|
@@ -1324,7 +1324,7 @@ _array_from_array_like(PyObject *op, | |
* this should be changed! | ||
*/ | ||
if (!writeable && tmp == Py_NotImplemented) { | ||
tmp = PyArray_FromArrayAttr(op, requested_dtype, context); | ||
tmp = PyArray_FromArrayAttr(op, requested_dtype, context); // Assume: array was copied. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems like a no to me. I expect even pandas breaks this and returns views (although they may be discussing to change it). Or things like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You removed the comment, but the behaviour remains identical?
is not rejected. Do we really want to live with that relaxed interpretation here? For the buffer protocol and array-struct/interface I can see it, but not for |
||
if (tmp == NULL) { | ||
return NULL; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is technically not necessarily true. Python has some very ugly code to try and guess if it is true for its argument parsing with
"s"
.I am not sure what to do about it though, maybe we can get away with assuming that it is true. Ideally it would always be true (or almost always, since it would make sense to add suboffsets to NumPy in the form of a copy!)
This may be something to discuss briefly.