[pypy-commit] pypy numpy-refactor: get/set item for scalars
fijal
noreply at buildbot.pypy.org
Sat Sep 1 23:20:17 CEST 2012
Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: numpy-refactor
Changeset: r57075:4782257ceb7a
Date: 2012-09-01 23:20 +0200
http://bitbucket.org/pypy/pypy/changeset/4782257ceb7a/
Log: get/set item for scalars
diff --git a/pypy/module/micronumpy/arrayimpl/scalar.py b/pypy/module/micronumpy/arrayimpl/scalar.py
--- a/pypy/module/micronumpy/arrayimpl/scalar.py
+++ b/pypy/module/micronumpy/arrayimpl/scalar.py
@@ -1,5 +1,6 @@
from pypy.module.micronumpy.arrayimpl import base
+from pypy.interpreter.error import OperationError
class ScalarIterator(base.BaseArrayIterator):
def __init__(self, v):
@@ -47,3 +48,12 @@
def transpose(self):
return self
+
+ def descr_getitem(self, space, w_idx):
+ raise OperationError(space.w_IndexError,
+ space.wrap("scalars cannot be indexed"))
+
+ def descr_setitem(self, space, w_idx, w_val):
+ raise OperationError(space.w_IndexError,
+ space.wrap("scalars cannot be indexed"))
+
More information about the pypy-commit
mailing list