[pypy-commit] pypy missing-ndarray-attributes: revert to fijal's version, add failing zjit test
mattip
noreply at buildbot.pypy.org
Fri Feb 1 08:26:09 CET 2013
Author: Matti Picus <matti.picus at gmail.com>
Branch: missing-ndarray-attributes
Changeset: r60803:39993e6bef4a
Date: 2013-02-01 09:23 +0200
http://bitbucket.org/pypy/pypy/changeset/39993e6bef4a/
Log: revert to fijal's version, add failing zjit test
diff --git a/pypy/module/micronumpy/arrayimpl/sort.py b/pypy/module/micronumpy/arrayimpl/sort.py
--- a/pypy/module/micronumpy/arrayimpl/sort.py
+++ b/pypy/module/micronumpy/arrayimpl/sort.py
@@ -82,14 +82,14 @@
def argsort_array(arr, space, w_axis):
itemtype = arr.dtype.itemtype
- ok_to_continue = isinstance(itemtype, types.Float)
- if isinstance(itemtype, types.Integer):
- ok_to_continue = True
- if isinstance(itemtype, types.ComplexFloating):
- ok_to_continue = True
- if not ok_to_continue:
- space.wrap("sorting of non-numeric types " + \
- "'%s' is not implemented" % arr.dtype.get_name() ))
+ if (not isinstance(itemtype, types.Float) and
+ not isinstance(itemtype, types.Integer) and
+ not isinstance(itemtype, types.ComplexFloating)
+ ):
+ # XXX this should probably be changed
+ raise OperationError(space.w_NotImplementedError,
+ space.wrap("sorting of non-numeric types " + \
+ "'%s' is not implemented" % arr.dtype.get_name(), ))
if w_axis is space.w_None:
# note that it's fine ot pass None here as we're not going
# to pass the result around (None is the link to base in slices)
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
@@ -35,7 +35,8 @@
pass
SINGLE_ARG_FUNCTIONS = ["sum", "prod", "max", "min", "all", "any",
- "unegative", "flat", "tostring","count_nonzero"]
+ "unegative", "flat", "tostring","count_nonzero",
+ "argsort"]
TWO_ARG_FUNCTIONS = ["dot", 'take']
THREE_ARG_FUNCTIONS = ['where']
@@ -482,6 +483,8 @@
w_res = cos.call(interp.space, [arr])
elif self.name == "flat":
w_res = arr.descr_get_flatiter(interp.space)
+ elif self.name == "argsort":
+ w_res = arr.descr_argsort(interp.space)
elif self.name == "tostring":
arr.descr_tostring(interp.space)
w_res = None
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
@@ -493,3 +493,14 @@
'new_with_vtable': 1,
'int_add': 2,
'float_ne': 1})
+
+ def define_argsort():
+ return """
+ a = |30|
+ argsort(a)
+ a->6
+ """
+
+ def test_argsort(self):
+ result = self.run("argsort")
+ assert result == 6
More information about the pypy-commit
mailing list