From 612cd65633eefea009b9f1aae6605b73523259d2 Mon Sep 17 00:00:00 2001 From: cgohlke Date: Wed, 5 Dec 2018 16:28:16 -0800 Subject: BUG: fix records.fromfile fails to read data >4 GB Use 64-bit integer accumulator for calculating the product of array shapes on 64-bit systems. Fixes #12442. --- numpy/core/records.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'numpy/core') diff --git a/numpy/core/records.py b/numpy/core/records.py index 9e09e46b3..db4a0fbd8 100644 --- a/numpy/core/records.py +++ b/numpy/core/records.py @@ -783,13 +783,13 @@ def fromfile(fd, dtype=None, shape=None, offset=0, formats=None, itemsize = descr.itemsize - shapeprod = sb.array(shape).prod() + shapeprod = sb.array(shape).prod(dtype=nt.intp) shapesize = shapeprod * itemsize if shapesize < 0: shape = list(shape) shape[shape.index(-1)] = size / -shapesize shape = tuple(shape) - shapeprod = sb.array(shape).prod() + shapeprod = sb.array(shape).prod(dtype=nt.intp) nbytes = shapeprod * itemsize -- cgit v1.2.1 From 5d3ff239a75bdfd59b2c4adbfd2af343b3a36007 Mon Sep 17 00:00:00 2001 From: Charles Harris Date: Thu, 6 Dec 2018 08:18:04 -0700 Subject: BUG: Fix `/` that should be `//`. Seems this old style division was missed when going to Python3 compatibility. --- numpy/core/records.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'numpy/core') diff --git a/numpy/core/records.py b/numpy/core/records.py index db4a0fbd8..86a43306a 100644 --- a/numpy/core/records.py +++ b/numpy/core/records.py @@ -787,7 +787,7 @@ def fromfile(fd, dtype=None, shape=None, offset=0, formats=None, shapesize = shapeprod * itemsize if shapesize < 0: shape = list(shape) - shape[shape.index(-1)] = size / -shapesize + shape[shape.index(-1)] = size // -shapesize shape = tuple(shape) shapeprod = sb.array(shape).prod(dtype=nt.intp) -- cgit v1.2.1