[pypy-commit] pypy voidtype_strformat: fix merge
mattip
noreply at buildbot.pypy.org
Thu Nov 21 23:52:01 CET 2013
Author: Matti Picus <matti.picus at gmail.com>
Branch: voidtype_strformat
Changeset: r68273:1ac497fd9a90
Date: 2013-11-22 00:50 +0200
http://bitbucket.org/pypy/pypy/changeset/1ac497fd9a90/
Log: fix merge
diff --git a/pypy/module/micronumpy/arrayimpl/concrete.py b/pypy/module/micronumpy/arrayimpl/concrete.py
--- a/pypy/module/micronumpy/arrayimpl/concrete.py
+++ b/pypy/module/micronumpy/arrayimpl/concrete.py
@@ -36,11 +36,7 @@
return backstrides
def getitem(self, index):
- from pypy.module.micronumpy.types import VoidType
- it = self.dtype.itemtype
- if isinstance(it, VoidType):
- return it.readarray(self, index, 0, self.dtype)
- return it.read(self, index, 0)
+ return self.dtype.itemtype.read(self, index, 0)
def getitem_bool(self, index):
return self.dtype.itemtype.read_bool(self, index, 0)
diff --git a/pypy/module/micronumpy/interp_ufuncs.py b/pypy/module/micronumpy/interp_ufuncs.py
--- a/pypy/module/micronumpy/interp_ufuncs.py
+++ b/pypy/module/micronumpy/interp_ufuncs.py
@@ -429,13 +429,7 @@
def find_binop_result_dtype(space, dt1, dt2, promote_to_float=False,
promote_bools=False):
# dt1.num should be <= dt2.num
- dt1num = dt1.num
- dt2num = dt2.num
- if dt1num == 20: #void type
- dt1num = dt1.subdtype.num
- if dt2num == 20:
- dt2num = dt2.subdtype.num
- if dt1num > dt2num:
+ if dt1.num > dt2.num:
dt1, dt2 = dt2, dt1
# Some operations promote op(bool, bool) to return int8, rather than bool
if promote_bools and (dt1.kind == dt2.kind == NPY_GENBOOLLTR):
@@ -443,11 +437,11 @@
# Everything numeric promotes to complex
if dt2.is_complex_type() or dt1.is_complex_type():
- if dt2num == NPY_CFLOAT:
+ if dt2.num == NPY_CFLOAT:
return interp_dtype.get_dtype_cache(space).w_complex64dtype
- elif dt2num == NPY_CDOUBLE:
+ elif dt2.num == NPY_CDOUBLE:
return interp_dtype.get_dtype_cache(space).w_complex128dtype
- elif dt2num == NPY_CLONGDOUBLE:
+ elif dt2.num == NPY_CLONGDOUBLE:
return interp_dtype.get_dtype_cache(space).w_complexlongdtype
else:
raise OperationError(space.w_TypeError, space.wrap("Unsupported types"))
@@ -461,7 +455,7 @@
# Everything promotes to float, and bool promotes to everything.
if dt2.kind == NPY_FLOATINGLTR or dt1.kind == NPY_GENBOOLLTR:
# Float32 + 8-bit int = Float64
- if dt2num == NPY_FLOAT and dt1.itemtype.get_element_size() >= 4:
+ if dt2.num == NPY_FLOAT and dt1.itemtype.get_element_size() >= 4:
return interp_dtype.get_dtype_cache(space).w_float64dtype
return dt2
@@ -471,8 +465,8 @@
if dt1.itemtype.get_element_size() < dt2.itemtype.get_element_size():
return dt2
# we need to promote both dtypes
- dtypenum = dt2num + 2
- elif dt2num == NPY_ULONGLONG or (LONG_BIT == 64 and dt2num == NPY_ULONG):
+ dtypenum = dt2.num + 2
+ elif dt2.num == NPY_ULONGLONG or (LONG_BIT == 64 and dt2.num == NPY_ULONG):
# UInt64 + signed = Float64
dtypenum = NPY_DOUBLE
elif dt2.is_flexible_type():
@@ -487,7 +481,7 @@
return dt2
else:
# increase to the next signed type
- dtypenum = dt2num + 1
+ dtypenum = dt2.num + 1
newdtype = interp_dtype.get_dtype_cache(space).dtypes_by_num[dtypenum]
if (newdtype.itemtype.get_element_size() > dt2.itemtype.get_element_size() or
More information about the pypy-commit
mailing list