Skip to content

Commit 0dafa9e

Browse files
committed
check number of arguments
[SVN r12238]
1 parent e83e8a8 commit 0dafa9e

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

include/boost/python/object/function.hpp

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,30 @@
88

99
# include <boost/python/detail/wrap_python.hpp>
1010
# include <boost/python/detail/config.hpp>
11+
# include <boost/python/reference.hpp>
1112
# include <boost/function.hpp>
1213

13-
namespace boost { namespace python { namespace object {
14+
namespace boost { namespace python { namespace objects {
1415

1516
// We use boost::function to avoid generating lots of virtual tables
1617
typedef boost::function2<PyObject*, PyObject*, PyObject*> py_function;
1718

1819
struct BOOST_PYTHON_DECL function : PyObject
1920
{
20-
function(py_function);
21+
function(py_function, unsigned min_args, unsigned max_args = 0);
2122
~function();
2223

2324
PyObject* call(PyObject*, PyObject*) const;
24-
private:
25+
void add_overload(function* overload);
26+
27+
private: // helper functions
28+
void argument_error(PyObject* args, PyObject* keywords) const;
29+
30+
private: // data members
2531
py_function m_fn;
32+
unsigned m_min_args;
33+
unsigned m_max_args;
34+
function* m_overloads;
2635
};
2736

2837
extern BOOST_PYTHON_DECL PyTypeObject function_type;
@@ -31,6 +40,6 @@ extern BOOST_PYTHON_DECL PyTypeObject function_type;
3140
// implementations
3241
//
3342

34-
}}} // namespace boost::python::object
43+
}}} // namespace boost::python::objects
3544

3645
#endif // FUNCTION_DWA20011214_HPP

0 commit comments

Comments
 (0)