def __init__(self, space, shape, length, address=r_uint(0)): memsize = shape.size * length # For W_ArrayInstances that are used as the result value of a # function call, ffi_call() writes 8 bytes into it even if the # function's result type asks for less. memsize = clibffi.adjust_return_size(memsize) W_DataInstance.__init__(self, space, memsize, address) self.length = length self.shape = shape
def __init__(self, space, shape, length, address=r_uint(0)): # Workaround for a strange behavior of libffi: make sure that # we always have at least 8 bytes. For W_ArrayInstances that are # used as the result value of a function call, ffi_call() writes # 8 bytes into it even if the function's result type asks for less. # This strange behavior is documented. memsize = shape.size * length if memsize < 8: memsize = 8 W_DataInstance.__init__(self, space, memsize, address) self.length = length self.shape = shape
def __init__(self, space, shape, address): W_DataInstance.__init__(self, space, shape.size, address) self.shape = shape
def __init__(self, space, shape, length, address=r_uint(0)): _, itemsize, _ = shape.itemtp W_DataInstance.__init__(self, space, itemsize * length, address) self.length = length self.shape = shape