I'm trying to debug an assertion error from Boost.Python, but having
no luck. I'm not a C++ programmer, but to my eyes, it seems like my
call should work. I'm using Boost 1.47.0 on an openSuSE 12.2 platform,
with GCC/G++ 4.4. These parameters are fixed (that is, suggestions
that I update any of them aren't going to fly - I am tied to those
versions by factors outside my control). Here's a simple example,
which used to work:

>>> service.Provider
<class 'tradelink.service.v9_4.service.Provider'>
>>> pro = service.Provider("Skip-hacking")
>>> pro2 = service.Provider("Skip-hacking", {})
>>> pro3 = service.Provider("Skip-hacking", {}, 4001)

I'm upgrading to accommodate some internal version dependency changes
in other internal libraries, which should (in theory) have no effect
on the build and functioning of the Boost.Python wrappers, certainly
of this particular wrapper. Still, something's amiss. Here's the same
example using my new version:

>>> service.Provider
<class 'tradelink.service.v9_5.service.Provider'>
>>> pro = service.Provider("Skip-hacking")
>>> pro2 = service.Provider("Skip-hacking", {})
ArgumentError Python argument types in
    Provider.__init__(Provider, str, dict)
did not match C++ signature:
    __init__(boost::python::api::object, std::string,
std::map<std::string, resource::variant, std::less<std::string>,
std::allocator<std::pair<std::string const, resource::variant> > >,
int)
    __init__(boost::python::api::object, std::string,
std::map<std::string, resource::variant, std::less<std::string>,
std::allocator<std::pair<std::string const, resource::variant> > >)
    __init__(boost::python::api::object, std::string)
[<stdin>|<module>|1]
>>> pro3 = service.Provider("Skip-hacking", {}, 4001)
ArgumentError Python argument types in
    Provider.__init__(Provider, str, dict, int)
did not match C++ signature:
    __init__(boost::python::api::object, std::string,
std::map<std::string, resource::variant, std::less<std::string>,
std::allocator<std::pair<std::string const, resource::variant> > >,
int)
    __init__(boost::python::api::object, std::string,
std::map<std::string, resource::variant, std::less<std::string>,
std::allocator<std::pair<std::string const, resource::variant> > >)
    __init__(boost::python::api::object, std::string)
[<stdin>|<module>|1]

It seems that Boost.Python doesn't think my empty dictionary is
compatible with the std::map<...> type. Even if I pass a small,
populated dictionary, it barfs:

>>> pro4 = service.Provider("Skip-hacking", {"name": "skip"})
ArgumentError Python argument types in
    Provider.__init__(Provider, str, dict)
did not match C++ signature:
    __init__(boost::python::api::object, std::string,
std::map<std::string, resource::variant, std::less<std::string>,
std::allocator<std::pair<std::string const, resource::variant> > >,
int)
    __init__(boost::python::api::object, std::string,
std::map<std::string, resource::variant, std::less<std::string>,
std::allocator<std::pair<std::string const, resource::variant> > >)
    __init__(boost::python::api::object, std::string)
[<stdin>|<module>|1]

The upgrade was only for version dependencies (we live in version
dependency hell at work). There were no code changes to either the
Boost.Python wrapper or the underlying C++ libraries between versions
9.4 and 9.5. In fact, this is very basic stuff in our environment
which hasn't changed functionally in several years.

I'd appreciate some insight about Boost.Python's thought processes.
Why doesn't it like my dictionaries (empty or populated)?

Thanks,

Skip
_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
https://mail.python.org/mailman/listinfo/cplusplus-sig

Reply via email to