1. Ranjith Kumar
  2. pypy

Commits

Antonio Cuni  committed 0dec605

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@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.

  • Participants
  • Parent commits 94f22d1
  • Branches jitypes2

Comments (0)

Files changed (2)

File lib_pypy/_ctypes/__init__.py

View file
 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

File lib_pypy/_ctypes/function.py

View file
             # 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_)