[pypy-svn] pypy jitypes2: correctly handle pointers as results. This makes test_functions.test_pointers passing

antocuni commits-noreply at bitbucket.org
Mon Dec 20 12:34:44 CET 2010


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: jitypes2
Changeset: r40139:28164bffd652
Date: 2010-12-20 12:34 +0100
http://bitbucket.org/pypy/pypy/changeset/28164bffd652/

Log:	correctly handle pointers as results. This makes test_functions.test_pointers passing

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
@@ -420,7 +420,11 @@
             if result == 0:
                 result = None
             else:
-                assert False, 'TODO'
+                # XXX: I could not find a more direct way to create a pointer
+                # to this specific address
+                address = result
+                result = restype()
+                result._buffer[0] = address
         elif restype._ffishape == 'z':
             result = restype(result).value # XXX: maybe it's the general way to do it?
         return result


More information about the Pypy-commit mailing list