From d4e9503358ea48bb9b558503cb372346ab386167 Mon Sep 17 00:00:00 2001 From: Pat Gunn Date: Fri, 1 Jun 2018 15:22:14 -0400 Subject: In numpy.memmap forcibly promote shape to uint64 --- numpy/core/memmap.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'numpy') diff --git a/numpy/core/memmap.py b/numpy/core/memmap.py index 5be45affd..315825b9f 100644 --- a/numpy/core/memmap.py +++ b/numpy/core/memmap.py @@ -236,10 +236,11 @@ class memmap(ndarray): raise ValueError("Size of available data is not a " "multiple of the data-type size.") size = bytes // _dbytes - shape = (size,) + shape = (np.uint64(size),) else: if not isinstance(shape, tuple): shape = (shape,) + shape = tuple(map(lambda x: np.uint64(x), shape)) # Force-promote to uint64, prevent possible overflow size = 1 for k in shape: size *= k -- cgit v1.2.1