diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2013-10-03 17:55:41 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2013-10-03 17:55:41 (GMT) |
commit | 60b183407cbcd19b211c2dd7ed9a59ff189844a8 (patch) | |
tree | 8d57a6e32f03b9bb54fcd23e7b2b14ea57691e76 /Objects/memoryobject.c | |
parent | def0a4c298358c50b0b53a8113551e9aee3532e5 (diff) | |
download | cpython-60b183407cbcd19b211c2dd7ed9a59ff189844a8.zip cpython-60b183407cbcd19b211c2dd7ed9a59ff189844a8.tar.gz cpython-60b183407cbcd19b211c2dd7ed9a59ff189844a8.tar.bz2 |
Issue #19014: memoryview.cast() is now allowed on zero-length views.
Diffstat (limited to 'Objects/memoryobject.c')
-rw-r--r-- | Objects/memoryobject.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Objects/memoryobject.c b/Objects/memoryobject.c index abd069b..189af88 100644 --- a/Objects/memoryobject.c +++ b/Objects/memoryobject.c @@ -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; |