Subject: [Boost-bugs] [Boost C++ Libraries] #5803: MPL assertion does not allow python to override protected virtual methods
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-08-22 18:02:48
#5803: MPL assertion does not allow python to override protected virtual methods
--------------------------------+-------------------------------------------
Reporter: mathstuf@⦠| Owner: rwgk
Type: Bugs | Status: new
Milestone: To Be Determined | Component: Python
Version: Boost 1.47.0 | Severity: Problem
Keywords: |
--------------------------------+-------------------------------------------
When wrapping a class with virtual protected methods, the following MPL
assertion is hit in
boost::python::detail::error::virtual_function_default<>
(python/class.hpp:141):
{{{
assertion<mpl::not_<is_same<Default,Fn> > >
}}}
The way I've been exposing the protected method so that the Python can
override it is:
{{{
class Base { protected: virtual void foo(); };
class BaseWrap : public Base, public wrapper<Base> { public: void foo();
void base_foo(); };
// ...
class_<BaseWrap, boost::noncopyable>("PythonBase")
.def("foo", &BaseWrap::foo, &BaseWrap::base_foo);
}}}
The assertion is *supposed* to be (following the function names) testing
that ``&BaseWrap::base_foo`` is a method of the wrapped class
(``BaseWrap``), but it does it in a way that precludes the main overriding
function from *also* being from ``BaseWrap`` which isn't really correct.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/5803> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:07 UTC