self.index = None
self.is_temp = True
self.use_managed_ref = True
+
+ if not MemoryView.validate_axes(self.pos, axes):
+ self.type = error_type
+ return
+
self.type = PyrexTypes.MemoryViewSliceType(
self.base.type.dtype, axes)
return axes_specs
+def validate_axes(pos, axes):
+ if len(axes) >= Options.buffer_max_dims:
+ error(pos, "More dimensions than the maximum number"
+ " of buffer dimensions were used.")
+ return False
+
+ return True
+
def all(it):
for item in it:
if not item:
self.type = PyrexTypes.ErrorType()
return self.type
- MemoryView.validate_memslice_dtype(self.pos, base_type)
- self.type = PyrexTypes.MemoryViewSliceType(base_type, axes_specs)
+ if not MemoryView.validate_axes(self.pos, axes_specs):
+ self.type = error_type
+ else:
+ MemoryView.validate_memslice_dtype(self.pos, base_type)
+ self.type = PyrexTypes.MemoryViewSliceType(base_type, axes_specs)
+ self.use_memview_utilities(env)
- self.use_memview_utilities(env)
return self.type
def use_memview_utilities(self, env):
cdef Valid[:] validslice
cdef Invalid[:] invalidslice
+cdef int[:, :, :, :] four_D
+four_D[None, None, None, None]
+four_D[None, None, None, None, None]
+
+cdef int[:, :, :, :, :, :, :, :] eight_D = object()
+
# These are VALID
cdef int[::view.indirect_contiguous, ::view.contiguous] a9
+four_D[None, None, None]
_ERRORS = u'''
11:25: Cannot specify an array that is both C and Fortran contiguous.
46:35: Can only create cython.array from pointer or array
47:24: Cannot assign type 'double' to 'Py_ssize_t'
55:13: Invalid base type for memoryview slice: Invalid
+58:6: More dimensions than the maximum number of buffer dimensions were used.
+59:6: More dimensions than the maximum number of buffer dimensions were used.
+61:9: More dimensions than the maximum number of buffer dimensions were used.
'''