[pypy-commit] cffi default: More

arigo noreply at buildbot.pypy.org
Sat Jun 23 16:36:26 CEST 2012


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r499:cc0b23317e1f
Date: 2012-06-23 16:32 +0200
http://bitbucket.org/cffi/cffi/changeset/cc0b23317e1f/

Log:	More

diff --git a/c/_ffi_backend.c b/c/_ffi_backend.c
--- a/c/_ffi_backend.c
+++ b/c/_ffi_backend.c
@@ -887,9 +887,7 @@
             PyErr_SetString(PyExc_ValueError, "empty union");
             return -1;
         }
-        if (bitfield_not_supported(cf) < 0)
-            return -1;
-        return convert_from_object(data, cf->cf_type, init);
+        return convert_field_from_object(data, cf, init);
     }
     PyErr_Format(PyExc_SystemError,
                  "convert_from_object: '%s'", ct->ct_name);
diff --git a/c/test_c.py b/c/test_c.py
--- a/c/test_c.py
+++ b/c/test_c.py
@@ -845,6 +845,11 @@
     assert p.a1 == -1
     p = newp(new_pointer_type(BStruct), {'a1': -1})
     assert p.a1 == -1
+    #
+    BUnion = new_union_type("bar")
+    complete_struct_or_union(BUnion, [('a1', BInt, 1)])
+    p = newp(new_pointer_type(BUnion), -1)
+    assert p.a1 == -1
 
 def test_weakref():
     import weakref


More information about the pypy-commit mailing list