From 0dafa9e2299d0b0f629482ce03998d30f4dff0a7 Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Mon, 7 Jan 2002 06:46:32 +0000 Subject: [PATCH] check number of arguments [SVN r12238] --- include/boost/python/object/function.hpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/include/boost/python/object/function.hpp b/include/boost/python/object/function.hpp index a0257676..ed7dd319 100644 --- a/include/boost/python/object/function.hpp +++ b/include/boost/python/object/function.hpp @@ -8,21 +8,30 @@ # include # include +# include # include -namespace boost { namespace python { namespace object { +namespace boost { namespace python { namespace objects { // We use boost::function to avoid generating lots of virtual tables typedef boost::function2 py_function; struct BOOST_PYTHON_DECL function : PyObject { - function(py_function); + function(py_function, unsigned min_args, unsigned max_args = 0); ~function(); PyObject* call(PyObject*, PyObject*) const; - private: + void add_overload(function* overload); + + private: // helper functions + void argument_error(PyObject* args, PyObject* keywords) const; + + private: // data members py_function m_fn; + unsigned m_min_args; + unsigned m_max_args; + function* m_overloads; }; extern BOOST_PYTHON_DECL PyTypeObject function_type; @@ -31,6 +40,6 @@ extern BOOST_PYTHON_DECL PyTypeObject function_type; // implementations // -}}} // namespace boost::python::object +}}} // namespace boost::python::objects #endif // FUNCTION_DWA20011214_HPP