[pypy-commit] pypy numpy-minilang: ok, not mix two spaces, leads to confusing errors

fijal noreply at buildbot.pypy.org
Thu Oct 27 22:52:46 CEST 2011


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: numpy-minilang
Changeset: r48542:c729d657e525
Date: 2011-10-27 22:52 +0200
http://bitbucket.org/pypy/pypy/changeset/c729d657e525/

Log:	ok, not mix two spaces, leads to confusing errors

diff --git a/pypy/module/micronumpy/compile.py b/pypy/module/micronumpy/compile.py
--- a/pypy/module/micronumpy/compile.py
+++ b/pypy/module/micronumpy/compile.py
@@ -114,8 +114,6 @@
         self.items = items
 
 
-space = FakeSpace()
-
 class InterpreterState(object):
     def __init__(self, code):
         self.code = code
@@ -176,7 +174,8 @@
             return w_lhs.descr_add(interp.space, w_rhs)
         elif self.name == '->':
             if isinstance(w_rhs, Scalar):
-                index = int(space.float_w(w_rhs.value.wrap(interp.space)))
+                index = int(interp.space.float_w(
+                    w_rhs.value.wrap(interp.space)))
                 return w_lhs.get_concrete().eval(index)
             else:
                 raise NotImplementedError
@@ -197,7 +196,8 @@
         return space.wrap(self.v)
 
     def execute(self, interp):
-        dtype = space.w_float64dtype
+        dtype = interp.space.fromcache(W_Float64Dtype)
+        assert isinstance(dtype, W_Float64Dtype)
         return Scalar(dtype, dtype.box(self.v))
 
 class RangeConstant(Node):
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
@@ -13,13 +13,6 @@
 
 
 class TestNumpyJIt(LLJitMixin):
-    def setup_class(cls):
-        cls.space = FakeSpace()
-        cls.float64_dtype = cls.space.fromcache(W_Float64Dtype)
-        cls.int64_dtype = cls.space.fromcache(W_Int64Dtype)
-        cls.uint64_dtype = cls.space.fromcache(W_UInt64Dtype)
-        cls.int32_dtype = cls.space.fromcache(W_Int32Dtype)
-
     def run(self, code):
         # trick annotator
         c = """


More information about the pypy-commit mailing list