[pypy-commit] cffi default: Test and fix.

arigo noreply at buildbot.pypy.org
Tue Jun 26 10:02:41 CEST 2012


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r515:2f8dba6f83aa
Date: 2012-06-25 23:37 +0200
http://bitbucket.org/cffi/cffi/changeset/2f8dba6f83aa/

Log:	Test and fix.

diff --git a/c/_ffi_backend.c b/c/_ffi_backend.c
--- a/c/_ffi_backend.c
+++ b/c/_ffi_backend.c
@@ -760,7 +760,8 @@
         if (!(ctinit->ct_flags & (CT_POINTER|CT_FUNCTIONPTR|CT_ARRAY)))
             goto cannot_convert;
         if (ctinit->ct_itemdescr != ct->ct_itemdescr &&
-            !(ct->ct_itemdescr->ct_flags & CT_CAST_ANYTHING))
+            !(ct->ct_itemdescr->ct_flags & CT_CAST_ANYTHING) &&
+            !(ctinit->ct_itemdescr->ct_flags & CT_CAST_ANYTHING))
             goto cannot_convert;
         ptrdata = ((CDataObject *)init)->c_data;
 
diff --git a/c/test_c.py b/c/test_c.py
--- a/c/test_c.py
+++ b/c/test_c.py
@@ -624,6 +624,9 @@
     s = newp(BStructPtr, [12, 34, 56, p])
     assert s.p4 == p
     #
+    s = newp(BStructPtr, [12, 34, 56, cast(BVoidP, 0)])
+    assert s.p4 == cast(BVoidP, 0)
+    #
     py.test.raises(TypeError, newp, BStructPtr, [12, 34, 56, None])
 
 def test_array_in_struct():


More information about the pypy-commit mailing list