[pypy-svn] r73336 - in pypy/branch/cpython-extension/pypy: module/cpyext/test rpython/lltypesystem

xoraxax at codespeak.net xoraxax at codespeak.net
Sat Apr 3 16:52:56 CEST 2010


Author: xoraxax
Date: Sat Apr  3 16:52:55 2010
New Revision: 73336

Modified:
   pypy/branch/cpython-extension/pypy/module/cpyext/test/test_typeobject.py
   pypy/branch/cpython-extension/pypy/rpython/lltypesystem/ll2ctypes.py
Log:
This test was passing on Py 2.6, but on 2.5 it hit a bug in ctypes. Make a workaround in PyPy.

Modified: pypy/branch/cpython-extension/pypy/module/cpyext/test/test_typeobject.py
==============================================================================
--- pypy/branch/cpython-extension/pypy/module/cpyext/test/test_typeobject.py	(original)
+++ pypy/branch/cpython-extension/pypy/module/cpyext/test/test_typeobject.py	Sat Apr  3 16:52:55 2010
@@ -65,13 +65,17 @@
         raises(TypeError, "obj.string_member_inplace = 42")
         raises(TypeError, "del obj.string_member_inplace")
 
-        skip("In progress")
+        #skip("In progress") # not at all, how does this fail for you amaury?
 
         a = module.fooType
         assert "cannot create" in raises(TypeError, "a()").value.message
         class bar(module.fooType):
-            pass
+            def baz(self):
+                return self
         assert "cannot create" in raises(TypeError, "bar()").value.message
         fuu = module.FuuType
-        fuu_inst = fuu(u"abc")
+        class fuu2(fuu):
+            def baz(self):
+                return self
+        assert fuu2(u"abc").baz().escape()
 

Modified: pypy/branch/cpython-extension/pypy/rpython/lltypesystem/ll2ctypes.py
==============================================================================
--- pypy/branch/cpython-extension/pypy/rpython/lltypesystem/ll2ctypes.py	(original)
+++ pypy/branch/cpython-extension/pypy/rpython/lltypesystem/ll2ctypes.py	Sat Apr  3 16:52:55 2010
@@ -666,7 +666,8 @@
     if T is lltype.Void:
         return None
     if isinstance(T, lltype.Ptr):
-        if not cobj:   # NULL pointer
+        if not cobj or not ctypes.cast(cobj, ctypes.c_void_p).value:   # NULL pointer
+            # CFunctionType.__nonzero__ is broken before Python 2.6
             return lltype.nullptr(T.TO)
         if isinstance(T.TO, lltype.Struct):
             REAL_TYPE = T.TO



More information about the Pypy-commit mailing list