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 /c/ffi_obj.c | |
parent | a108629085d42284fa84fcc0f563cff98dd78af7 (diff) | |
download | cffi-da438dc658d9007d2d375116ce647a4b982aa227.tar.gz |
New argument "onerror" on ffi.callback()
Diffstat (limited to 'c/ffi_obj.c')
-rw-r--r-- | c/ffi_obj.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/c/ffi_obj.c b/c/ffi_obj.c index 0f407e3..3899289 100644 --- a/c/ffi_obj.c +++ b/c/ffi_obj.c @@ -714,11 +714,13 @@ static PyObject *_ffi_callback_decorator(PyObject *outer_args, PyObject *fn) static PyObject *ffi_callback(FFIObject *self, PyObject *args, PyObject *kwds) { PyObject *c_decl, *python_callable = Py_None, *error = Py_None; - PyObject *res; - static char *keywords[] = {"cdecl", "python_callable", "error", NULL}; + PyObject *res, *onerror = Py_None; + static char *keywords[] = {"cdecl", "python_callable", "error", + "onerror", NULL}; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|OO", keywords, - &c_decl, &python_callable, &error)) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|OOO", keywords, + &c_decl, &python_callable, &error, + &onerror)) return NULL; c_decl = (PyObject *)_ffi_type(self, c_decl, ACCEPT_STRING | ACCEPT_CTYPE | @@ -726,7 +728,7 @@ static PyObject *ffi_callback(FFIObject *self, PyObject *args, PyObject *kwds) if (c_decl == NULL) return NULL; - args = Py_BuildValue("(OOO)", c_decl, python_callable, error); + args = Py_BuildValue("(OOOO)", c_decl, python_callable, error, onerror); if (args == NULL) return NULL; |