id summary reporter owner description type status milestone component version severity resolution keywords cc 2049 extracting c++ pointer from python object with multiple parents bloodyfanatic@… Dave Abrahams "Extracting a C++ pointer from a python object which inherited two base classes form C++ doesn't work correctly. Only the first base can be extracted, the second cannot be extracted under all circumstances. The script runs within an embedded python interpreter. CPP code: {{{ #define BOOST_PYTHON_STATIC_LIB #include using namespace boost::python; class Base1 { public: virtual ~Base1() {} }; class Base2 { public: virtual ~Base2() {} }; void extractBase1( boost::python::object& obj) { Base1* ex1 = extract(obj) BOOST_EXTRACT_WORKAROUND; Base1& ex2 = extract(obj) BOOST_EXTRACT_WORKAROUND; } void extractBase2( boost::python::object& obj) { Base2* ex1 = extract(obj) BOOST_EXTRACT_WORKAROUND; Base2& ex2 = extract(obj) BOOST_EXTRACT_WORKAROUND; } BOOST_PYTHON_MODULE(Test_ext) { class_(""Base1""); class_(""Base2""); def(""extractBase1"", extractBase1); def(""extractBase2"", extractBase2); } int main(int, char **) { try { Py_Initialize(); initTest_ext(); object main = import(""__main__""); object dictionary(main.attr(""__dict__"")); object result = exec_file(""test.py"", dictionary, dictionary ); } catch (error_already_set) { PyErr_Print(); } return 0; } }}} test.py: {{{ from Test_ext import * class both1(Base1, Base2): def foo(self): print ""foo!"" class both2(Base2, Base1): def foo(self): print ""foo2!"" obj1 = both1() extractBase1(obj1) extractBase2(obj1) # doesn't work obj2 = both() extractBase1(obj2) # doesn't work extractBase2(obj2) }}} " Bugs closed python USE GITHUB Boost 1.35.0 Problem invalid Stefan Seefeld