[pypy-commit] pypy default: Use space.eq_w() instead of space.eq() in Method.descr_method_eq().
mjacob
pypy.commits at gmail.com
Thu Mar 2 05:18:46 EST 2017
Author: Manuel Jacob <me at manueljacob.de>
Branch:
Changeset: r90466:23186813950a
Date: 2017-03-02 11:10 +0100
http://bitbucket.org/pypy/pypy/changeset/23186813950a/
Log: Use space.eq_w() instead of space.eq() in Method.descr_method_eq().
diff --git a/pypy/interpreter/function.py b/pypy/interpreter/function.py
--- a/pypy/interpreter/function.py
+++ b/pypy/interpreter/function.py
@@ -556,7 +556,7 @@
return space.w_False
if not space.eq_w(self.w_instance, w_other.w_instance):
return space.w_False
- return space.eq(self.w_function, w_other.w_function)
+ return space.newbool(space.eq_w(self.w_function, w_other.w_function))
def is_w(self, space, other):
if not isinstance(other, Method):
diff --git a/pypy/interpreter/test/test_function.py b/pypy/interpreter/test/test_function.py
--- a/pypy/interpreter/test/test_function.py
+++ b/pypy/interpreter/test/test_function.py
@@ -560,6 +560,18 @@
assert A().m == X()
assert X() == A().m
+ def test_method_equals_with_identity(self):
+ from types import MethodType
+ class CallableBadEq(object):
+ def __call__(self):
+ pass
+ def __eq__(self, other):
+ raise ZeroDivisionError
+ func = CallableBadEq()
+ meth = MethodType(func, object)
+ assert meth == meth
+ assert meth == MethodType(func, object)
+
@pytest.mark.skipif("config.option.runappdirect")
def test_method_identity(self):
class A(object):
More information about the pypy-commit
mailing list