Opened 15 years ago
Last modified 4 years ago
#1460 reopened Bugs
Python classes with multiple bases are convertible only to the first class in the lists (even if super(classname, self).__init__() is called)
Reported by: | Owned by: | Dave Abrahams | |
---|---|---|---|
Milestone: | To Be Determined | Component: | python USE GITHUB |
Version: | Boost 1.34.1 | Severity: | Problem |
Keywords: | Cc: |
Description
first reported here: http://mail.python.org/pipermail/c++-sig/2007-October/012926.html
C++: #include <boost/python.hpp> namespace bp = boost::python; struct A { }; struct B { }; void test_A(const A &) { } void test_B(const B &) { } BOOST_PYTHON_MODULE(multiple_inheritance) { bp::def("test_A", &test_A); bp::def("test_B", &test_B); bp::class_<A>("A", bp::init<>()); bp::class_<B>("B", bp::init<>()); } Python: class C(A, B): pass test_A(C()) test_B(C()) And I get: Traceback (most recent call last): File "./multiple_inheritance.py", line 10, in <module> test_B(C()) Boost.Python.ArgumentError: Python argument types in multiple_inheritance.test_B(C) did not match C++ signature: test_B(B)
I will try to figure it out once I am done with the exceptions.
Change History (4)
comment:1 by , 15 years ago
comment:2 by , 15 years ago
Component: | None → Python |
---|---|
Owner: | set to |
comment:3 by , 13 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
You have to initialize your base classes in the derived object's constructor. I committed a passing test to git, will work its way into svn eventually:
http://gitorious.org/~straszheim/boost/straszheim/commit/ec9c7f7b48a40bf8136597242457f40a349b2fe3
comment:4 by , 4 years ago
Resolution: | invalid |
---|---|
Status: | closed → reopened |
Summary: | Python classes with multiple bases are convertible only to the first class in the lists → Python classes with multiple bases are convertible only to the first class in the lists (even if super(classname, self).__init__() is called) |
I made a detailed comment explaining why I think this issue should be reexamined, but the spam filter ate it. Hopefully, an admin can approve it.
Note:
See TracTickets
for help on using tickets.
bleh, I wanted to choose the Python component.