[pypy-svn] pypy fast-forward: Before calling a Python callback, from python, check that the arguments are convertible.

amauryfa commits-noreply at bitbucket.org
Fri Jan 14 20:17:19 CET 2011


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: fast-forward
Changeset: r40700:dff8741aec1b
Date: 2011-01-14 19:35 +0100
http://bitbucket.org/pypy/pypy/changeset/dff8741aec1b/

Log:	Before calling a Python callback, from python, check that the
	arguments are convertible. Ideally, we should go through ffi like
	cpython does

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
@@ -184,6 +184,9 @@
                     "This function takes %d argument%s (%s given)"
                     % (len(self._argtypes_), plural, len(args)))
 
+            # check that arguments are convertible
+            self._convert_args(self._argtypes_, args)
+
             try:
                 res = self.callable(*args)
             except:


More information about the Pypy-commit mailing list