From swig-user 7/6/11: fix closure for tp_call.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12761 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Stefan Zager 2011-07-20 15:20:24 +00:00
commit 498367bc9d
4 changed files with 15 additions and 1 deletions

View file

@ -39,6 +39,8 @@ wrapper##_closure(PyObject *a, PyObject *b) { \
return result; \
}
typedef ternaryfunc ternarycallfunc;
#define SWIGPY_TERNARYFUNC_CLOSURE(wrapper) \
SWIGINTERN PyObject * \
wrapper##_closure(PyObject *a, PyObject *b, PyObject *c) { \
@ -54,6 +56,12 @@ wrapper##_closure(PyObject *a, PyObject *b, PyObject *c) { \
return result; \
}
#define SWIGPY_TERNARYCALLFUNC_CLOSURE(wrapper) \
SWIGINTERN PyObject * \
wrapper##_closure(PyObject *callable_object, PyObject *args, PyObject *) { \
return wrapper(callable_object, args); \
}
#define SWIGPY_LENFUNC_CLOSURE(wrapper) \
SWIGINTERN Py_ssize_t \
wrapper##_closure(PyObject *a) { \
@ -498,3 +506,4 @@ SwigPyBuiltin_SetMetaType (PyTypeObject *type, PyTypeObject *metatype)
#ifdef __cplusplus
}
#endif

View file

@ -123,7 +123,7 @@
%rename(__invert__) *::operator~;
%feature("python:slot", "nb_invert", functype="unaryfunc") *::operator~;
%rename(__call__) *::operator();
%feature("python:slot", "tp_call", functype="ternaryfunc") *::operator();
%feature("python:slot", "tp_call", functype="ternarycallfunc") *::operator();
#if defined(SWIGPYTHON_BUILTIN)
%pybinoperator(__nonzero__, *::operator bool, inquiry, nb_nonzero);