Author: Antonio Cuni <[email protected]>
Branch: py3k
Changeset: r53070:220421a31811
Date: 2012-03-01 17:52 +0100
http://bitbucket.org/pypy/pypy/changeset/220421a31811/
Log: hg merge default
diff --git a/pypy/interpreter/typedef.py b/pypy/interpreter/typedef.py
--- a/pypy/interpreter/typedef.py
+++ b/pypy/interpreter/typedef.py
@@ -66,7 +66,7 @@
@interp2app
def auto__le__(space, w_self, w_other):
- return space.not_(space.gt(w_self, w_other))
+ return space.not_(space.lt(w_other, w_self))
@interp2app
def auto__gt__(space, w_self, w_other):
diff --git a/pypy/module/array/interp_array.py
b/pypy/module/array/interp_array.py
--- a/pypy/module/array/interp_array.py
+++ b/pypy/module/array/interp_array.py
@@ -572,14 +572,32 @@
raise OperationError(space.w_ValueError, space.wrap(msg))
# Compare methods
- def cmp__Array_ANY(space, self, other):
+ def _cmp_impl(space, self, other, space_fn):
if isinstance(other, W_ArrayBase):
w_lst1 = array_tolist__Array(space, self)
w_lst2 = space.call_method(other, 'tolist')
- return space.cmp(w_lst1, w_lst2)
+ return space_fn(w_lst1, w_lst2)
else:
return space.w_NotImplemented
+ def eq__Array_ANY(space, self, other):
+ return _cmp_impl(space, self, other, space.eq)
+
+ def ne__Array_ANY(space, self, other):
+ return _cmp_impl(space, self, other, space.ne)
+
+ def lt__Array_ANY(space, self, other):
+ return _cmp_impl(space, self, other, space.lt)
+
+ def le__Array_ANY(space, self, other):
+ return _cmp_impl(space, self, other, space.le)
+
+ def gt__Array_ANY(space, self, other):
+ return _cmp_impl(space, self, other, space.gt)
+
+ def ge__Array_ANY(space, self, other):
+ return _cmp_impl(space, self, other, space.ge)
+
# Misc methods
def buffer__Array(space, self):
diff --git a/pypy/module/array/test/test_array.py
b/pypy/module/array/test/test_array.py
--- a/pypy/module/array/test/test_array.py
+++ b/pypy/module/array/test/test_array.py
@@ -504,11 +504,11 @@
assert (a >= c) is False
assert (c >= a) is True
- assert cmp(a, a) == 0
- assert cmp(a, b) == 0
- assert cmp(a, c) < 0
- assert cmp(b, a) == 0
- assert cmp(c, a) > 0
+ assert a == a
+ assert a == b
+ assert a < c
+ assert b == a
+ assert c > a
def test_reduce(self):
import pickle
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit