[pypy-svn] pypy fast-forward: ctypes: For some reason a callback is not allowed to return a Pointer.

amauryfa commits-noreply at bitbucket.org
Fri Jan 14 18:24:57 CET 2011


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: fast-forward
Changeset: r40689:70472b8fa819
Date: 2011-01-14 16:24 +0100
http://bitbucket.org/pypy/pypy/changeset/70472b8fa819/

Log:	ctypes: For some reason a callback is not allowed to return a
	Pointer. Only SimpleTypes are allowed.

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
@@ -1,5 +1,6 @@
 
 from _ctypes.basics import _CData, _CDataMeta, cdata_from_address
+from _ctypes.primitive import SimpleType
 from _ctypes.basics import ArgumentError, keepalive_key
 from _ctypes.builtin import set_errno, set_last_error
 import _rawffi
@@ -98,7 +99,7 @@
     def _ffishapes(self, args, restype):
         argtypes = [arg._ffiargshape for arg in args]
         if restype is not None:
-            if not isinstance(restype, _CDataMeta):
+            if not isinstance(restype, SimpleType):
                 raise TypeError("invalid result type for callback function")
             restype = restype._ffiargshape
         else:


More information about the Pypy-commit mailing list