Boost logo

Boost :

From: Ivan A. Vigasin (vig_at_[hidden])
Date: 2001-11-13 08:36:29


Hello, All

I have problem with mixing extension classes with python classes.

$ python tmp.py
Traceback (most recent call last):
  File "tmp.py", line 12, in ?
      b=B()
    File "tmp.py", line 10, in __init__
        A.__init__(self)
  TypeError: unbound method __init__() must be called with instance as first argument

Where tmp.py is:

class A:
  def __init__(self):
    pass

from extmodule import ExtClass

class B(A,ExtClass):
  def __init__(self):
    A.__init__(self)
    ExtClass.__init__(self)

b=B()

In C++:
test_boost.cc:
...
 python::class_builder<ExtClass> connect_class(this_module, "ExtClass" );
 connect_class.def( python::constructor<>() );
...

All OK when using single inheritance or multiple with both extension classes.

Regards, Ivan <vig_at_[hidden]>
ICQ: 22181170


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk