[pypy-svn] pypy jitypes2: manually re-apply this changeset (limited to function.py); test_callbacks.test_callback_void passes again

antocuni commits-noreply at bitbucket.org
Wed Mar 23 13:58:00 CET 2011


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: jitypes2
Changeset: r42864:0dec6052e015
Date: 2011-03-23 11:59 +0100
http://bitbucket.org/pypy/pypy/changeset/0dec6052e015/

Log:	manually re-apply this changeset (limited to function.py);
	test_callbacks.test_callback_void passes again

	 changeset: 41736:b6997048efb8 user: Amaury Forgeot
	d'Arc <amauryfa at gmail.com> date: Wed Feb 09 15:50:44 2011
	+0100 summary: Don't print a TypeError when a "void f()"
	callback function returns None.

diff --git a/lib_pypy/_ctypes/__init__.py b/lib_pypy/_ctypes/__init__.py
--- a/lib_pypy/_ctypes/__init__.py
+++ b/lib_pypy/_ctypes/__init__.py
@@ -4,7 +4,7 @@
 from _ctypes.primitive import _SimpleCData
 from _ctypes.pointer import _Pointer, _cast_addr
 from _ctypes.pointer import POINTER, pointer, _pointer_type_cache
-from _ctypes.function import CFuncPtr, call_function
+from _ctypes.function import CFuncPtr#, call_function
 from _ctypes.dll import dlopen
 from _ctypes.structure import Structure
 from _ctypes.array import Array

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
@@ -140,6 +140,8 @@
             # A callback into python
             self.callable = argument
             ffiargs, ffires = self._ffishapes(self._argtypes_, self._restype_)
+            if self._restype_ is None:
+                ffires = None
             self._ptr = _rawffi.CallbackPtr(self._wrap_callable(argument,
                                                                 self.argtypes),
                                             ffiargs, ffires, self._flags_)


More information about the Pypy-commit mailing list