Author: Matti Picus <[email protected]>
Branch: py3.5
Changeset: r93792:ec92ed49e47f
Date: 2018-02-09 12:17 -0500
http://bitbucket.org/pypy/pypy/changeset/ec92ed49e47f/
Log: no tp_compare on py3, revert 14e8d60878c2 prehaps issue #2740 still
broken on py3?
diff --git a/pypy/module/cpyext/test/test_typeobject.py
b/pypy/module/cpyext/test/test_typeobject.py
--- a/pypy/module/cpyext/test/test_typeobject.py
+++ b/pypy/module/cpyext/test/test_typeobject.py
@@ -265,11 +265,6 @@
assert cmpr.__le__(4) is NotImplemented
-
- def test_unhashable_when_tpcompare(self):
- module = self.import_module("comparisons")
- cmpr = module.OldCmpType()
- raises(TypeError, hash, cmpr)
def test_hash(self):
module = self.import_module("comparisons")
cmpr = module.CmpType()
diff --git a/pypy/module/cpyext/typeobject.py b/pypy/module/cpyext/typeobject.py
--- a/pypy/module/cpyext/typeobject.py
+++ b/pypy/module/cpyext/typeobject.py
@@ -344,9 +344,9 @@
# two special cases where __hash__ is explicitly set to None
# (which leads to an unhashable type):
# 1) tp_hash == PyObject_HashNotImplemented
- # 2) tp_hash == NULL and either of tp_compare or
tp_richcompare are not NULL
+ # 2) tp_hash == NULL and tp_richcompare not NULL
if hash_not_impl == func or (
- not func and (pto.c_tp_compare or
pto.c_tp_richcompare)):
+ not func and pto.c_tp_richcompare):
dict_w[method_name] = space.w_None
continue
else:
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit