diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2013-10-03 17:56:54 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2013-10-03 17:56:54 (GMT) |
commit | 0e61ed8400cbd3ad4e845f23f8e36ce989271f1b (patch) | |
tree | ef007d2a623ebf55e2d390e0f16b4352d67db932 /Objects | |
parent | 026af2a597d94eb61310dd5360cf901529ef33a2 (diff) | |
parent | 60b183407cbcd19b211c2dd7ed9a59ff189844a8 (diff) | |
download | cpython-0e61ed8400cbd3ad4e845f23f8e36ce989271f1b.zip cpython-0e61ed8400cbd3ad4e845f23f8e36ce989271f1b.tar.gz cpython-0e61ed8400cbd3ad4e845f23f8e36ce989271f1b.tar.bz2 |
Issue #19014: memoryview.cast() is now allowed on zero-length views.
Diffstat (limited to 'Objects')
-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 e57af18..1d52d9d 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; |