Author: Maciej Fijalkowski <[email protected]>
Branch: numpy-refactor
Changeset: r57025:a3131def450c
Date: 2012-08-30 17:51 +0200
http://bitbucket.org/pypy/pypy/changeset/a3131def450c/
Log: support index
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
@@ -45,7 +45,10 @@
def int_w(space, w_obj):
# a special version that respects both __index__ and __int__
# XXX add __index__ support
- return space.int_w(space.int(w_obj))
+ try:
+ return space.int_w(space.index(w_obj))
+ except OperationError:
+ return space.int_w(space.int(w_obj))
class ConcreteArray(base.BaseArrayImplementation):
start = 0
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit