[pypy-commit] pypy cpyext-hash_notimpl: fix for test, skip if not translated

mattip pypy.commits at gmail.com
Fri Jul 7 02:37:57 EDT 2017


Author: Matti Picus <matti.picus at gmail.com>
Branch: cpyext-hash_notimpl
Changeset: r91710:217e03c35f1f
Date: 2017-07-07 09:36 +0300
http://bitbucket.org/pypy/pypy/changeset/217e03c35f1f/

Log:	fix for test, skip if not translated

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
@@ -1351,6 +1351,9 @@
 
 class AppTestHashable(AppTestCpythonExtensionBase):
     def test_unhashable(self):
+        if not self.runappdirect:
+            skip('pointer to function equality available'
+                 ' only after translation')
         module = self.import_extension('foo', [
            ("new_obj", "METH_NOARGS",
             '''
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
@@ -347,12 +347,9 @@
         if len(slot_names) == 1:
             func = getattr(pto, slot_names[0])
             if slot_names[0] == 'c_tp_hash':
-                # XXX if it is hash_not_impl, do not assign to dict_w
-                # name = rffi.charp2str(pto.c_tp_name)
-                # if 'foo' in name:
-                #    import pdb;pdb.set_trace()
                 if hash_not_impl == func:
-                    # XXX never reached
+                    # special case for tp_hash == PyObject_HashNotImplemented
+                    dict_w[method_name] = space.w_None
                     continue
         else:
             assert len(slot_names) == 2


More information about the pypy-commit mailing list