diff options
author | Armin Rigo <arigo@tunes.org> | 2015-07-04 21:52:34 +0200 |
---|---|---|
committer | Armin Rigo <arigo@tunes.org> | 2015-07-04 21:52:34 +0200 |
commit | da438dc658d9007d2d375116ce647a4b982aa227 (patch) | |
tree | b541af40bb402b6ee556cc99c06706c92737a7cd /cffi | |
parent | a108629085d42284fa84fcc0f563cff98dd78af7 (diff) | |
download | cffi-da438dc658d9007d2d375116ce647a4b982aa227.tar.gz |
New argument "onerror" on ffi.callback()
Diffstat (limited to 'cffi')
-rw-r--r-- | cffi/api.py | 5 | ||||
-rw-r--r-- | cffi/backend_ctypes.py | 3 |
2 files changed, 5 insertions, 3 deletions
diff --git a/cffi/api.py b/cffi/api.py index 4a63ac4..e141a11 100644 --- a/cffi/api.py +++ b/cffi/api.py @@ -286,7 +286,7 @@ class FFI(object): """ return self._backend.from_buffer(self.BCharA, python_buffer) - def callback(self, cdecl, python_callable=None, error=None): + def callback(self, cdecl, python_callable=None, error=None, onerror=None): """Return a callback object or a decorator making such a callback object. 'cdecl' must name a C function pointer type. The callback invokes the specified 'python_callable' (which may @@ -298,7 +298,8 @@ class FFI(object): if not callable(python_callable): raise TypeError("the 'python_callable' argument " "is not callable") - return self._backend.callback(cdecl, python_callable, error) + return self._backend.callback(cdecl, python_callable, + error, onerror) if isinstance(cdecl, basestring): cdecl = self._typeof(cdecl, consider_function_as_funcptr=True) if python_callable is None: diff --git a/cffi/backend_ctypes.py b/cffi/backend_ctypes.py index 5cc0c2a..b061cda 100644 --- a/cffi/backend_ctypes.py +++ b/cffi/backend_ctypes.py @@ -989,7 +989,8 @@ class CTypesBackend(object): def cast(self, BType, source): return BType._cast_from(source) - def callback(self, BType, source, error): + def callback(self, BType, source, error, onerror): + assert onerror is None # XXX not implemented return BType(source, error) typeof = type |