#1 Dummy pure virtual overloads for void* returning methods

closed
nobody
None
5
2007-01-09
2007-01-06
Kulik
No

Hi, first of all I would like to apologise you for not making a patch, I know I already submitted 2 bugs and no patch. Sorry about that. I am much more a C++ junkie, learning python (well to be honest I just started learning it).

Py++ generates the wrapping code of the same nature even for void* returning virtual methods. It sets the calling policy to opaque pointer, but this code in the wrapping class won't compile:

virtual void * method(){
bp::override func_method = this->get_override( "method" );
return func_method();
}

because the python function would have to return reference to void (void&) and that's not possible in C.

I could just exclude that method and don't wrap it at all (it isn't usable from python anyway, since it's dealing with binary data and casting, etc), but the problem is that it's pure virtual. The wrapper has to overload it and just generate something like:

virtual void * method(){
assert( 0 );
}

It won't get called/overloaded from python anyway. If it isn't overloaded, gcc complains that it can't instantiate abstract class (the wrapper).

Also boost::python::opaque_pointer_converter<void*> seems to be invalid, opaque pointer can't be void* unless I am mistaken.

Discussion

  • Kulik
    Kulik
    2007-01-06

    • summary: Dummy pure virutal overloads for void returning methods --> Dummy pure virtual overloads for void returning methods
     
  • Roman
    Roman
    2007-01-08

    Logged In: YES
    user_id=1084190
    Originator: NO

    The patch to the http://language-binding.net/pyplusplus/quotes.html#who-is-using-py
    page is welcome :-)

    I guess you are using non CVS version of Boost.Python right? I don't have the problems
    you describe.

    Nevertheless, I think I implemented solution pretty close to what you need.
    Take a look on non_overridable_tester.py ( SVN ).

     
  • Kulik
    Kulik
    2007-01-08

    Logged In: YES
    user_id=1620918
    Originator: YES

    The can't instantiate abstract class ....wrapper error is still there. I think it's because I use stable boost::python, I will update to the CVS boost::python and post results.

     
  • Kulik
    Kulik
    2007-01-08

    Logged In: YES
    user_id=1620918
    Originator: YES

    It works with boost CVS!

    <OT>
    And the new boost has many nice toys for me to play with :)
    The only thing that bugz me is that they still didn't fix that stupid boost::any bug I submitted, so I have to patch every the header all the time :(
    </OT>

     
  • Roman
    Roman
    2007-01-09

    • status: open --> closed