-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
BUG: view with fieldless dtype should raise if itemsize != 0 #14393
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 all commits
847aefc
9b740ef
7c3adfb
d6f7524
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
PyDataType_ISUNSIZED(descr) now returns False for structured datatypes | ||
---------------------------------------------------------------------- | ||
Previously this returned True for any datatype of itemsize 0, but now this | ||
returns false for the non-flexible datatype with itemsize 0, ``np.dtype([])``. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1861,7 +1861,7 @@ array_reduce_ex(PyArrayObject *self, PyObject *args) | |
PyDataType_FLAGCHK(descr, NPY_ITEM_HASOBJECT) || | ||
(PyType_IsSubtype(((PyObject*)self)->ob_type, &PyArray_Type) && | ||
((PyObject*)self)->ob_type != &PyArray_Type) || | ||
PyDataType_ISUNSIZED(descr)) { | ||
descr->elsize == 0) { | ||
There was a problem hiding this c 67E6 omment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not clear to me why this condition is needed at all, although it admittedly looks harmless. 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. not clear to me either. These lines previously discussed here: https://github.com/numpy/numpy/pull/12748/files#r249258808 and introduced in #12011, but not discussed there. |
||
/* The PickleBuffer class from version 5 of the pickle protocol | ||
* can only be used for arrays backed by a contiguous data buffer. | ||
* For all other cases we fallback to the generic array_reduce | ||
|
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.
Fixes gh-13438, I think