[C++-sig] Problem with current pyste and inheritance

Gideon May gideon at computer.org
Tue Jan 27 20:09:25 CET 2004


Hi,

I've got a C++ class hierarchy which looks like this:

Base
  ^
  |
Derived
  ^
  |
Sub

and I want to use pyste to generate python bindings.
I've got it working except for the fact that the bindings
for Derived are being defined twice by pyste.
I've attached the include files and pyste files. I generate
the code with the following command:
  pyste --module=double Base.pyste Derived.pyste Sub.pyste

Any suggestions ?

Thanks,

Gideon
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Base.pyste
Type: application/octet-stream
Size: 32 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20040127/4328cac5/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Derived.pyste
Type: application/octet-stream
Size: 63 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20040127/4328cac5/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Sub.pyste
Type: application/octet-stream
Size: 54 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20040127/4328cac5/attachment-0002.obj>
-------------- next part --------------

// Boost Includes ==============================================================
#include <boost/python.hpp>
#include <boost/cstdint.hpp>

// Includes ====================================================================
#include <Base.h>
#include <Derived.h>
#include <Sub.h>

// Using =======================================================================
using namespace boost::python;

// Module ======================================================================
BOOST_PYTHON_MODULE(double)
{
    class_< Base >("Base", init<  >())
        .def(init< const Base& >())
    ;

    class_< Derived >("Derived", init<  >())
        .def(init< const Derived& >())
    ;

    class_< Derived >("Derived", init<  >())
        .def(init< const Derived& >())
    ;

    class_< Sub, bases< Derived >  >("Sub", init<  >())
        .def(init< const Sub& >())
    ;

}

-------------- next part --------------
class Base {
  public:
    Base();
};
-------------- next part --------------
#include "Base.h"

class Derived : Base {
  public:
    Derived();
};
-------------- next part --------------
#include "Derived.h"

class Sub : public Derived {
  public:
    Sub();
};


More information about the Cplusplus-sig mailing list