Author: Alex Gaynor <alex.gay...@gmail.com> Branch: numpy-dtype-alt Changeset: r46707:715a7cf297a1 Date: 2011-08-22 13:05 -0500 http://bitbucket.org/pypy/pypy/changeset/715a7cf297a1/
Log: add NonConstant nonsense to make zjit tests pass. 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 @@ -1,7 +1,6 @@ import math from pypy.module.micronumpy import interp_dtype, signature -from pypy.rlib import rfloat from pypy.tool.sourcetools import func_with_new_name diff --git a/pypy/module/micronumpy/test/test_zjit.py b/pypy/module/micronumpy/test/test_zjit.py --- a/pypy/module/micronumpy/test/test_zjit.py +++ b/pypy/module/micronumpy/test/test_zjit.py @@ -3,7 +3,7 @@ from pypy.module.micronumpy import interp_ufuncs, signature from pypy.module.micronumpy.compile import (numpy_compile, FakeSpace, FloatObject, IntObject, BoolObject) -from pypy.module.micronumpy.interp_dtype import W_Float64Dtype +from pypy.module.micronumpy.interp_dtype import W_Float64Dtype, W_Int64Dtype from pypy.module.micronumpy.interp_numarray import (BaseArray, SingleDimArray, SingleDimSlice, scalar_w) from pypy.rlib.nonconst import NonConstant @@ -15,6 +15,7 @@ def setup_class(cls): cls.space = FakeSpace() cls.float64_dtype = cls.space.fromcache(W_Float64Dtype) + cls.int64_dtype = cls.space.fromcache(W_Int64Dtype) def test_add(self): def f(i): @@ -47,9 +48,14 @@ def test_sum(self): space = self.space float64_dtype = self.float64_dtype + int64_dtype = self.int64_dtype def f(i): - ar = SingleDimArray(i, dtype=NonConstant(float64_dtype)) + if NonConstant(False): + dtype = int64_dtype + else: + dtype = float64_dtype + ar = SingleDimArray(i, dtype=dtype) v = ar.descr_add(space, ar).descr_sum(space) assert isinstance(v, FloatObject) return v.floatval @@ -63,9 +69,14 @@ def test_prod(self): space = self.space float64_dtype = self.float64_dtype + int64_dtype = self.int64_dtype def f(i): - ar = SingleDimArray(i, dtype=NonConstant(float64_dtype)) + if NonConstant(False): + dtype = int64_dtype + else: + dtype = float64_dtype + ar = SingleDimArray(i, dtype=dtype) v = ar.descr_add(space, ar).descr_prod(space) assert isinstance(v, FloatObject) return v.floatval _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit