[pypy-commit] pypy default: fix for 32 bit
mattip
noreply at buildbot.pypy.org
Sat Jul 25 19:32:42 CEST 2015
Author: mattip <matti.picus at gmail.com>
Branch:
Changeset: r78663:c2af38ee8b4f
Date: 2015-07-25 20:11 +0300
http://bitbucket.org/pypy/pypy/changeset/c2af38ee8b4f/
Log: fix for 32 bit
diff --git a/pypy/module/micronumpy/descriptor.py b/pypy/module/micronumpy/descriptor.py
--- a/pypy/module/micronumpy/descriptor.py
+++ b/pypy/module/micronumpy/descriptor.py
@@ -9,7 +9,7 @@
from rpython.rlib import jit
from rpython.rlib.objectmodel import (
specialize, compute_hash, we_are_translated, enforceargs)
-from rpython.rlib.rarithmetic import r_longlong, r_ulonglong
+from rpython.rlib.rarithmetic import r_longlong, r_ulonglong, ovfcheck
from pypy.module.micronumpy import types, boxes, support, constants as NPY
from .base import W_NDimArray
from pypy.module.micronumpy.appbridge import get_appbridge_cache
@@ -975,8 +975,12 @@
if shape is not None:
subdtype = make_new_dtype(space, w_subtype, w_dtype, alignment, copy, w_metadata=w_metadata)
assert isinstance(subdtype, W_Dtype)
- size = support.product(shape)
- size *= subdtype.elsize
+ try:
+ size = support.product(shape)
+ size = ovfcheck(size * subdtype.elsize)
+ except OverflowError:
+ raise oefmt(space.w_ValueError, "invalid shape in fixed-type tuple: "
+ "dtype size in bytes must fit into a C int.")
if size > 0x7fffffff:
raise oefmt(space.w_ValueError, "invalid shape in fixed-type tuple: "
"dtype size in bytes must fit into a C int.")
More information about the pypy-commit
mailing list