[pypy-svn] pypy jitypes2: use the proper is_struct flag when needed

antocuni commits-noreply at bitbucket.org
Mon Dec 27 19:04:31 CET 2010


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: jitypes2
Changeset: r40244:f0e41a172646
Date: 2010-12-27 19:03 +0100
http://bitbucket.org/pypy/pypy/changeset/f0e41a172646/

Log:	use the proper is_struct flag when needed

diff --git a/pypy/module/_ffi/interp_ffi.py b/pypy/module/_ffi/interp_ffi.py
--- a/pypy/module/_ffi/interp_ffi.py
+++ b/pypy/module/_ffi/interp_ffi.py
@@ -172,12 +172,14 @@
         # handled by the ULONG case).
         restype = self.func.restype
         call = self.func.call
+        is_struct = libffi.types.is_struct(restype)
         if restype is libffi.types.ulong:
             # special case
             uintres = call(argchain, rffi.ULONG)
             return space.wrap(uintres)
-        elif restype is libffi.types.pointer or libffi.types.is_struct(restype):
-            uintres = rffi.cast(rffi.ULONG, call(argchain, rffi.VOIDP))
+        elif restype is libffi.types.pointer or is_struct:
+            ptrres = call(argchain, rffi.VOIDP, is_struct=is_struct)
+            uintres = rffi.cast(rffi.ULONG, ptrres)
             return space.wrap(uintres)
         elif restype is libffi.types.uint:
             intres = rffi.cast(rffi.LONG, call(argchain, rffi.UINT))


More information about the Pypy-commit mailing list