Author: Matti Picus <[email protected]>
Branch: cpyext-unhashable
Changeset: r91378:ff2ce5a214bd
Date: 2017-05-22 21:45 +0300
http://bitbucket.org/pypy/pypy/changeset/ff2ce5a214bd/
Log: backed out 552622605578, breaks too many things
diff --git a/pypy/module/cpyext/methodobject.py
b/pypy/module/cpyext/methodobject.py
--- a/pypy/module/cpyext/methodobject.py
+++ b/pypy/module/cpyext/methodobject.py
@@ -272,7 +272,6 @@
__objclass__ = interp_attrproperty_w('w_objclass', cls=W_PyCWrapperObject),
__repr__ = interp2app(W_PyCWrapperObject.descr_method_repr),
# XXX missing: __getattribute__
- __hash__ = None
)
W_PyCWrapperObject.typedef.acceptable_as_base_class = False
diff --git a/pypy/module/cpyext/test/test_arraymodule.py
b/pypy/module/cpyext/test/test_arraymodule.py
--- a/pypy/module/cpyext/test/test_arraymodule.py
+++ b/pypy/module/cpyext/test/test_arraymodule.py
@@ -159,11 +159,3 @@
fd = BytesIO()
# only test that it works
fd.write(a)
-
- def test_hash(self):
- module = self.import_module(name='array')
- a = module.array('c')
- exc = raises(TypeError, hash, a)
- assert 'unhashable' in str(exc.value)
- exc = raises(TypeError, hash, a.__mul__)
- assert 'unhashable' in str(exc.value)
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
@@ -338,6 +338,7 @@
setattr(struct, slot_names[1], slot_func_helper)
def add_operators(space, dict_w, pto):
+ # XXX support PyObject_HashNotImplemented
for method_name, slot_names, wrapper_func, wrapper_func_kwds, doc in
slotdefs_for_wrappers:
if method_name in dict_w:
continue
@@ -364,8 +365,6 @@
rffi.charp2str(cts.cast('char*', pto.c_tp_doc)))
if pto.c_tp_new:
add_tp_new_wrapper(space, dict_w, pto)
- if not pto.c_tp_hash:
- dict_w['__hash__'] = space.w_None
@slot_function([PyObject, PyObject, PyObject], PyObject)
def tp_new_wrapper(space, self, w_args, w_kwds):
@@ -944,7 +943,6 @@
if w_obj.is_cpytype():
Py_DecRef(space, pto.c_tp_dict)
w_dict = w_obj.getdict(space)
-
# pass in the w_obj to convert any values that are
# unbound GetSetProperty into bound PyGetSetDescrObject
pto.c_tp_dict = make_ref(space, w_dict, w_obj)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit