[pypy-svn] pypy jitypes2: support for returning struct by value: test_struct_return_2H passes

antocuni commits-noreply at bitbucket.org
Tue Dec 28 09:31:16 CET 2010


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: jitypes2
Changeset: r40252:108349442748
Date: 2010-12-28 09:30 +0100
http://bitbucket.org/pypy/pypy/changeset/108349442748/

Log:	support for returning struct by value: test_struct_return_2H passes

diff --git a/lib_pypy/_ctypes/function.py b/lib_pypy/_ctypes/function.py
--- a/lib_pypy/_ctypes/function.py
+++ b/lib_pypy/_ctypes/function.py
@@ -440,6 +440,8 @@
                 result._buffer[0] = address
         elif restype._ffishape == 'z':
             result = restype(result).value # XXX: maybe it's the general way to do it?
+        elif self._is_struct_shape(restype._ffishape):
+            result = restype.from_address(result)
         return result
 
     def _build_result(self, restype, resbuffer, argtypes, argsandobjs):


More information about the Pypy-commit mailing list