[pypy-commit] pypy ffistruct: fix a typo, and initialize one more field for this dummy type

antocuni noreply at buildbot.pypy.org
Tue May 15 14:45:01 CEST 2012


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: ffistruct
Changeset: r55101:334f1c6af541
Date: 2012-05-15 12:17 +0200
http://bitbucket.org/pypy/pypy/changeset/334f1c6af541/

Log:	fix a typo, and initialize one more field for this dummy type

diff --git a/pypy/module/_ffi/interp_struct.py b/pypy/module/_ffi/interp_struct.py
--- a/pypy/module/_ffi/interp_struct.py
+++ b/pypy/module/_ffi/interp_struct.py
@@ -83,18 +83,18 @@
         self.w_ffitype.set_ffitype(ffistruct.ffistruct)
         self._ffistruct_owner = FFIStructOwner(ffistruct)
 
-    def check_complete(self):
+    def check_complete(self, space):
         if self.fields_w is None:
             raise operationerrfmt(space.w_ValueError, "%s has an incomplete type",
                                   self.w_ffitype.name)
 
     def allocate(self, space):
-        self.check_complete()
+        self.check_complete(space)
         return W__StructInstance(self)
 
     @unwrap_spec(addr=int)
     def fromaddress(self, space, addr):
-        self.check_complete()
+        self.check_complete(space)
         rawmem = rffi.cast(rffi.VOIDP, addr)
         return W__StructInstance(self, allocate=False, autofree=True, rawmem=rawmem)
 
diff --git a/pypy/module/_ffi/test/test_struct.py b/pypy/module/_ffi/test/test_struct.py
--- a/pypy/module/_ffi/test/test_struct.py
+++ b/pypy/module/_ffi/test/test_struct.py
@@ -60,6 +60,7 @@
         dummy_type = lltype.malloc(clibffi.FFI_TYPE_P.TO, flavor='raw')
         dummy_type.c_size = r_uint(123)
         dummy_type.c_alignment = rffi.cast(rffi.USHORT, 0)
+        dummy_type.c_type = rffi.cast(rffi.USHORT, 0)
         cls.w_dummy_type = W_FFIType('dummy', dummy_type)
         
     def test__StructDescr(self):


More information about the pypy-commit mailing list