function with >15 args yields get_signature error
Hi, Wrapping a function f with 16 arguments: int f(int x1, int x2, int x3, int x4, int x5, int x6, int x7, int x8, int x9, int x10, int x11, int x12, int x13, int x14, int x15, int x16) { return x1; } BOOST_PYTHON_MODULE(test) { def("f",f); } yields /usr/include/boost/python/make_function.hpp: In function ‘boost::python::api::object boost::python::make_function(F) [with F = int (*)(int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int)]’: /usr/include/boost/python/def.hpp:82: instantiated from ‘boost::python::api::object boost::python::detail::make_function1(T, ...) [with T = int (*)(int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int)]’ /usr/include/boost/python/def.hpp:91: instantiated from ‘void boost::python::def(const char*, Fn) [with Fn = int (*)(int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int)]’ test_module.cpp:20: instantiated from here /usr/include/boost/python/make_function.hpp:104: error: no matching function for call to ‘get_signature(int (*&)(int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int))’ make: *** [stream.o] Error 1 whereas all is fine if that last arg "int x16" is removed. All of gcc-4.2, gcc-4.3 and gcc-4.4 seem to exhibit the same behaviour. Same effect for libboost-python1.38-dev on Ubuntu karmic and libboost-python1.35-dev on Ubuntu jaunty. I need that 16th arg and more ... about 32 args, I think. Thanks for any help you can offer. cheers, Eilif -- Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3.5 - sicherer, schneller und einfacher! http://portal.gmx.net/de/go/atbrowser -- Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3.5 - sicherer, schneller und einfacher! http://portal.gmx.net/de/go/atbrowser
Eilif Mueller wrote:
Hi,
Wrapping a function f with 16 arguments:
int f(int x1, int x2, int x3, int x4, int x5, int x6, int x7, int x8, int x9, int x10, int x11, int x12, int x13, int x14, int x15, int x16) {
return x1;
}
BOOST_PYTHON_MODULE(test) {
def("f",f);
}
yields
/usr/include/boost/python/make_function.hpp: In function ‘boost::python::api::object boost::python::make_function(F) [with F = int (*)(int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int)]’: /usr/include/boost/python/def.hpp:82: instantiated from ‘boost::python::api::object boost::python::detail::make_function1(T, ...) [with T = int (*)(int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int)]’ /usr/include/boost/python/def.hpp:91: instantiated from ‘void boost::python::def(const char*, Fn) [with Fn = int (*)(int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int)]’ test_module.cpp:20: instantiated from here /usr/include/boost/python/make_function.hpp:104: error: no matching function for call to ‘get_signature(int (*&)(int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int))’ make: *** [stream.o] Error 1
whereas all is fine if that last arg "int x16" is removed. All of gcc-4.2, gcc-4.3 and gcc-4.4 seem to exhibit the same behaviour. Same effect for libboost-python1.38-dev on Ubuntu karmic and libboost-python1.35-dev on Ubuntu jaunty.
I need that 16th arg and more ... about 32 args, I think.
Thanks for any help you can offer.
This came up recently. You're going to have various problems (not all boost.python problems) getting arity that large. The workaround is to introduce an intermediate function that takes a boost::python::tuple and forward to the zillion-arguments one, example here: http://gitorious.org/~straszheim/boost/straszheim/blobs/python/libs/python/t... -t
There is a config macro BOOST_PYTHON_MAX_ARITY which may work for you. I'm not sure how high you can increase this number though. Refer to: http://www.boost.org/doc/libs/1_40_0/libs/python/doc/v2/configuration.html -----Original Message----- From: cplusplus-sig-bounces+wladwig=wdtinc.com@python.org [mailto:cplusplus-sig-bounces+wladwig=wdtinc.com@python.org] On Behalf Of Eilif Mueller Sent: Monday, October 26, 2009 12:02 PM To: cplusplus-sig@python.org Subject: [C++-sig] function with >15 args yields get_signature error Hi, Wrapping a function f with 16 arguments: int f(int x1, int x2, int x3, int x4, int x5, int x6, int x7, int x8, int x9, int x10, int x11, int x12, int x13, int x14, int x15, int x16) { return x1; } BOOST_PYTHON_MODULE(test) { def("f",f); } yields /usr/include/boost/python/make_function.hpp: In function 'boost::python::api::object boost::python::make_function(F) [with F = int (*)(int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int)]': /usr/include/boost/python/def.hpp:82: instantiated from 'boost::python::api::object boost::python::detail::make_function1(T, ...) [with T = int (*)(int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int)]' /usr/include/boost/python/def.hpp:91: instantiated from 'void boost::python::def(const char*, Fn) [with Fn = int (*)(int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int)]' test_module.cpp:20: instantiated from here /usr/include/boost/python/make_function.hpp:104: error: no matching function for call to 'get_signature(int (*&)(int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int))' make: *** [stream.o] Error 1 whereas all is fine if that last arg "int x16" is removed. All of gcc-4.2, gcc-4.3 and gcc-4.4 seem to exhibit the same behaviour. Same effect for libboost-python1.38-dev on Ubuntu karmic and libboost-python1.35-dev on Ubuntu jaunty. I need that 16th arg and more ... about 32 args, I think. Thanks for any help you can offer. cheers, Eilif -- Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3.5 - sicherer, schneller und einfacher! http://portal.gmx.net/de/go/atbrowser -- Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3.5 - sicherer, schneller und einfacher! http://portal.gmx.net/de/go/atbrowser _______________________________________________ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig
Hi, Thanks! -DBOOST_PYTHON_MAX_ARITY=34 did indeed help ... for simple functions it did the trick, and it did increase my limit for member functions, but only to 25. For over 25 args for a member functions of an exposed class I get the following compiler error: /usr/include/boost/python/detail/invoke.hpp:81: error: must use ‘.*’ or ‘->*’ to call pointer-to-member function in ‘f (...)’ #include <boost/python.hpp> using namespace boost::python; class MyClass { public: int qq(int x1, int x2, int x3, int x4, int x5, int x6, int x7, int x8, int x9, int x10, int x11, int x12, int x13, int x14, int x15, int x16, int x17, int x18, int x19, int x20, int x21, int x22, int x23, int x24, float x25 /*,float x26*/); }; BOOST_PYTHON_MODULE(mytest) { class_< MyClass >("MyClass", init<>() ) .def("qq",&MyClass::qq); } Any ideas? cheers, Eilif -------- Original-Nachricht --------
Datum: Mon, 26 Oct 2009 12:20:14 -0500 Von: William Ladwig <wladwig@wdtinc.com> An: Development of Python/C++ integration <cplusplus-sig@python.org> Betreff: Re: [C++-sig] function with >15 args yields get_signature error
There is a config macro BOOST_PYTHON_MAX_ARITY which may work for you. I'm not sure how high you can increase this number though. Refer to:
http://www.boost.org/doc/libs/1_40_0/libs/python/doc/v2/configuration.html
-----Original Message----- From: cplusplus-sig-bounces+wladwig=wdtinc.com@python.org [mailto:cplusplus-sig-bounces+wladwig=wdtinc.com@python.org] On Behalf Of Eilif Mueller Sent: Monday, October 26, 2009 12:02 PM To: cplusplus-sig@python.org Subject: [C++-sig] function with >15 args yields get_signature error
Hi,
Wrapping a function f with 16 arguments:
int f(int x1, int x2, int x3, int x4, int x5, int x6, int x7, int x8, int x9, int x10, int x11, int x12, int x13, int x14, int x15, int x16) {
return x1;
}
BOOST_PYTHON_MODULE(test) {
def("f",f);
}
yields
/usr/include/boost/python/make_function.hpp: In function 'boost::python::api::object boost::python::make_function(F) [with F = int (*)(int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int)]': /usr/include/boost/python/def.hpp:82: instantiated from 'boost::python::api::object boost::python::detail::make_function1(T, ...) [with T = int (*)(int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int)]' /usr/include/boost/python/def.hpp:91: instantiated from 'void boost::python::def(const char*, Fn) [with Fn = int (*)(int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int)]' test_module.cpp:20: instantiated from here /usr/include/boost/python/make_function.hpp:104: error: no matching function for call to 'get_signature(int (*&)(int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int))' make: *** [stream.o] Error 1
whereas all is fine if that last arg "int x16" is removed. All of gcc-4.2, gcc-4.3 and gcc-4.4 seem to exhibit the same behaviour. Same effect for libboost-python1.38-dev on Ubuntu karmic and libboost-python1.35-dev on Ubuntu jaunty.
I need that 16th arg and more ... about 32 args, I think.
Thanks for any help you can offer.
cheers,
Eilif
-- Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3.5 - sicherer, schneller und einfacher! http://portal.gmx.net/de/go/atbrowser
-- Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3.5 - sicherer, schneller und einfacher! http://portal.gmx.net/de/go/atbrowser _______________________________________________ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig _______________________________________________ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig
-- Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3.5 - sicherer, schneller und einfacher! http://portal.gmx.net/de/go/atbrowser
Yeah. Find the guy who wrote a function with over 25 arguments. Bring a baseball bat. Persuade him of his error. -----Original Message----- From: cplusplus-sig-bounces+matthew.scouten=tradingtechnologies.com@python.org [mailto:cplusplus-sig-bounces+matthew.scouten=tradingtechnologies.com@python.org] On Behalf Of Eilif Mueller Sent: Monday, October 26, 2009 3:59 PM To: Development of Python/C++ integration Subject: Re: [C++-sig] function with >15 args yields get_signature error Hi, Thanks! -DBOOST_PYTHON_MAX_ARITY=34 did indeed help ... for simple functions it did the trick, and it did increase my limit for member functions, but only to 25. For over 25 args for a member functions of an exposed class I get the following compiler error: /usr/include/boost/python/detail/invoke.hpp:81: error: must use ‘.*’ or ‘->*’ to call pointer-to-member function in ‘f (...)’ #include <boost/python.hpp> using namespace boost::python; class MyClass { public: int qq(int x1, int x2, int x3, int x4, int x5, int x6, int x7, int x8, int x9, int x10, int x11, int x12, int x13, int x14, int x15, int x16, int x17, int x18, int x19, int x20, int x21, int x22, int x23, int x24, float x25 /*,float x26*/); }; BOOST_PYTHON_MODULE(mytest) { class_< MyClass >("MyClass", init<>() ) .def("qq",&MyClass::qq); } Any ideas? cheers, Eilif -------- Original-Nachricht --------
Datum: Mon, 26 Oct 2009 12:20:14 -0500 Von: William Ladwig <wladwig@wdtinc.com> An: Development of Python/C++ integration <cplusplus-sig@python.org> Betreff: Re: [C++-sig] function with >15 args yields get_signature error
There is a config macro BOOST_PYTHON_MAX_ARITY which may work for you. I'm not sure how high you can increase this number though. Refer to:
http://www.boost.org/doc/libs/1_40_0/libs/python/doc/v2/configuration.html
-----Original Message----- From: cplusplus-sig-bounces+wladwig=wdtinc.com@python.org [mailto:cplusplus-sig-bounces+wladwig=wdtinc.com@python.org] On Behalf Of Eilif Mueller Sent: Monday, October 26, 2009 12:02 PM To: cplusplus-sig@python.org Subject: [C++-sig] function with >15 args yields get_signature error
Hi,
Wrapping a function f with 16 arguments:
int f(int x1, int x2, int x3, int x4, int x5, int x6, int x7, int x8, int x9, int x10, int x11, int x12, int x13, int x14, int x15, int x16) {
return x1;
}
BOOST_PYTHON_MODULE(test) {
def("f",f);
}
yields
/usr/include/boost/python/make_function.hpp: In function 'boost::python::api::object boost::python::make_function(F) [with F = int (*)(int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int)]': /usr/include/boost/python/def.hpp:82: instantiated from 'boost::python::api::object boost::python::detail::make_function1(T, ...) [with T = int (*)(int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int)]' /usr/include/boost/python/def.hpp:91: instantiated from 'void boost::python::def(const char*, Fn) [with Fn = int (*)(int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int)]' test_module.cpp:20: instantiated from here /usr/include/boost/python/make_function.hpp:104: error: no matching function for call to 'get_signature(int (*&)(int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int))' make: *** [stream.o] Error 1
whereas all is fine if that last arg "int x16" is removed. All of gcc-4.2, gcc-4.3 and gcc-4.4 seem to exhibit the same behaviour. Same effect for libboost-python1.38-dev on Ubuntu karmic and libboost-python1.35-dev on Ubuntu jaunty.
I need that 16th arg and more ... about 32 args, I think.
Thanks for any help you can offer.
cheers,
Eilif
-- Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3.5 - sicherer, schneller und einfacher! http://portal.gmx.net/de/go/atbrowser
-- Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3.5 - sicherer, schneller und einfacher! http://portal.gmx.net/de/go/atbrowser _______________________________________________ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig _______________________________________________ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig
-- Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3.5 - sicherer, schneller und einfacher! http://portal.gmx.net/de/go/atbrowser _______________________________________________ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig
Matthew Scouten (TT) wrote:
Yeah. Find the guy who wrote a function with over 25 arguments. Bring a baseball bat. Persuade him of his error.
+1. "Clue-by-four" time.
-----Original Message----- From: cplusplus-sig-bounces+matthew.scouten=tradingtechnologies.com@python.org [mailto:cplusplus-sig-bounces+matthew.scouten=tradingtechnologies.com@python.org] On Behalf Of Eilif Mueller Sent: Monday, October 26, 2009 3:59 PM To: Development of Python/C++ integration Subject: Re: [C++-sig] function with >15 args yields get_signature error
Hi,
Thanks! -DBOOST_PYTHON_MAX_ARITY=34 did indeed help ... for simple functions it did the trick, and it did increase my limit for member functions, but only to 25. For over 25 args for a member functions of an exposed class I get the following compiler error:
/usr/include/boost/python/detail/invoke.hpp:81: error: must use ‘.*’ or ‘->*’ to call pointer-to-member function in ‘f (...)’
I believe this is because BOOST_PYTHON_MAX_ARITY doesn't have the ability to change the hardcoded limit of 25 parameters in boost/type_traits/detail/is_mem_fun_ptr_impl.hpp, which boost.python uses. This is why I recommended that workaround. -t
Hi, Try use this flag in your compilation, -DBOOST_PYTHON_MAX_ARITY=XX The default value is 15, the I think thi can solve your problem. BR Renato Araujo Oliveira Filho On Mon, Oct 26, 2009 at 2:01 PM, Eilif Mueller <eilif@gmx.de> wrote:
Hi,
Wrapping a function f with 16 arguments:
int f(int x1, int x2, int x3, int x4, int x5, int x6, int x7, int x8, int x9, int x10, int x11, int x12, int x13, int x14, int x15, int x16) {
return x1;
}
BOOST_PYTHON_MODULE(test) {
def("f",f);
}
yields
/usr/include/boost/python/make_function.hpp: In function ‘boost::python::api::object boost::python::make_function(F) [with F = int (*)(int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int)]’: /usr/include/boost/python/def.hpp:82: instantiated from ‘boost::python::api::object boost::python::detail::make_function1(T, ...) [with T = int (*)(int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int)]’ /usr/include/boost/python/def.hpp:91: instantiated from ‘void boost::python::def(const char*, Fn) [with Fn = int (*)(int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int)]’ test_module.cpp:20: instantiated from here /usr/include/boost/python/make_function.hpp:104: error: no matching function for call to ‘get_signature(int (*&)(int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int))’ make: *** [stream.o] Error 1
whereas all is fine if that last arg "int x16" is removed. All of gcc-4.2, gcc-4.3 and gcc-4.4 seem to exhibit the same behaviour. Same effect for libboost-python1.38-dev on Ubuntu karmic and libboost-python1.35-dev on Ubuntu jaunty.
I need that 16th arg and more ... about 32 args, I think.
Thanks for any help you can offer.
cheers,
Eilif
-- Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3.5 - sicherer, schneller und einfacher! http://portal.gmx.net/de/go/atbrowser
-- Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3.5 - sicherer, schneller und einfacher! http://portal.gmx.net/de/go/atbrowser _______________________________________________ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig
participants (5)
-
Eilif Mueller -
Matthew Scouten (TT) -
Renato Araujo -
troy d. straszheim -
William Ladwig