mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Issue #19014: memoryview.cast() is now allowed on zero-length views.
This commit is contained in:
commit
0e61ed8400
3 changed files with 13 additions and 5 deletions
|
@ -1330,7 +1330,7 @@ memory_cast(PyMemoryViewObject *self, PyObject *args, PyObject *kwds)
|
|||
"memoryview: casts are restricted to C-contiguous views");
|
||||
return NULL;
|
||||
}
|
||||
if (zero_in_shape(self)) {
|
||||
if ((shape || self->view.ndim != 1) && zero_in_shape(self)) {
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
"memoryview: cannot cast view with zeros in shape or strides");
|
||||
return NULL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue