[pypy-commit] pypy numpypy-issue1137: fixed the FakeSpace just enough to work again.

timo_jbo noreply at buildbot.pypy.org
Sat May 5 16:12:57 CEST 2012


Author: Timo Paulssen <timonator at perpetuum-immobile.de>
Branch: numpypy-issue1137
Changeset: r54897:657b043bac5a
Date: 2012-05-05 16:11 +0200
http://bitbucket.org/pypy/pypy/changeset/657b043bac5a/

Log:	fixed the FakeSpace just enough to work again.

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
@@ -6,6 +6,7 @@
 import re
 
 from pypy.interpreter.baseobjspace import InternalSpaceCache, W_Root
+from pypy.interpreter.error import OperationError
 from pypy.module.micronumpy import interp_boxes
 from pypy.module.micronumpy.interp_dtype import get_dtype_cache
 from pypy.module.micronumpy.interp_numarray import (Scalar, BaseArray,
@@ -39,11 +40,11 @@
 THREE_ARG_FUNCTIONS = ['where']
 
 class FakeSpace(object):
-    w_ValueError = None
-    w_TypeError = None
-    w_IndexError = None
-    w_OverflowError = None
-    w_NotImplementedError = None
+    w_ValueError = "ValueError"
+    w_TypeError = "TypeError"
+    w_IndexError = "IndexError"
+    w_OverflowError = "OverflowError"
+    w_NotImplementedError = "NotImplementedError"
     w_None = None
 
     w_bool = "bool"
@@ -126,6 +127,8 @@
             return w_obj.intval
         elif isinstance(w_obj, FloatObject):
             return int(w_obj.floatval)
+        elif isinstance(w_obj, SliceObject):
+            raise OperationError(self.w_TypeError, self.wrap("slice."))
         raise NotImplementedError
 
     def index(self, w_obj):


More information about the pypy-commit mailing list