|
12 | 12 | # include <boost/python/object/function.hpp> |
13 | 13 | # include <boost/python/object/make_holder.hpp> |
14 | 14 | # include <boost/python/detail/caller.hpp> |
| 15 | +# include <boost/python/detail/arg_tuple_size.hpp> |
15 | 16 |
|
16 | 17 | namespace boost { namespace python { |
17 | 18 |
|
18 | 19 | template <class F> |
19 | | -PyObject* make_function(F f) |
| 20 | +objects::function* make_function(F f) |
20 | 21 | { |
21 | | - return new object::function( |
22 | | - object::py_function( |
23 | | - bind<PyObject*>(detail::caller(), f, _1, _2))); |
| 22 | + return new objects::function( |
| 23 | + objects::py_function( |
| 24 | + bind<PyObject*>(detail::caller(), f, _1, _2)) |
| 25 | + , detail::arg_tuple_size<F>::value); |
24 | 26 | } |
25 | 27 |
|
26 | 28 | template <class T, class ArgList, class Generator> |
27 | | -PyObject* make_constructor(T* = 0, ArgList* = 0, Generator* = 0) |
| 29 | +objects::function* make_constructor(T* = 0, ArgList* = 0, Generator* = 0) |
28 | 30 | { |
29 | 31 | enum { nargs = mpl::size<ArgList>::value }; |
30 | | - return new object::function( |
31 | | - object::py_function( |
| 32 | + return new objects::function( |
| 33 | + objects::py_function( |
32 | 34 | bind<PyObject*>(detail::caller(), |
33 | | - object::make_holder<nargs> |
| 35 | + objects::make_holder<nargs> |
34 | 36 | ::template apply<T,Generator,ArgList>::execute |
35 | | - , _1, _2))); |
| 37 | + , _1, _2)) |
| 38 | + , nargs + 1); |
36 | 39 | } |
37 | 40 |
|
38 | 41 | }} // namespace boost::python |
|
0 commit comments