Boost logo

Boost :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2001-11-14 10:46:30


Rats. I see why that's happening.

I suggest you try Python 2.2b1 instead.
I know it isn't nice to force prerelease software on you, but this is a
/really/ hard problem.

Python wraps all functions that go into a class declaration in something
called a "method", which adds all kinds of arbitrary restrictions (pre 2.2)
about what sorts of objects it can be called on. The "self" object is not a
true Python class, and A's base classes explicitly reach out to /their/ base
classes and grab the unbound __init__ method, so there's no chance for
Boost.Python to intervene and unwrap the method object so it can get at the
underlying function which can actually be called on extension classes. I
can't imagine any tricks which would allow us a way around these
restrictions.

-Dave

----- Original Message -----
From: "Ivan A. Vigasin" <vig_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Wednesday, November 14, 2001 10:02 AM
Subject: Re: [boost] Multiple inheritance & constructors problem.
Boost.python

> On Wed, 14 Nov 2001, David Abrahams wrote:
>
> > Perhaps. What versions are you using?
> Python 2.1 on Solaris8, boost-1.24
>
> > OK, I believe that Python2.2 is just being liberal, here. If you look at
the
> > code below, Boost.Python only does that method unwinding when looking at
> > /base/ class attributes. So, this should work for you:
> >
> > class Base:
> > def __init__(self):
> > self.x = 'x'
> > class BasePrime(Base):
> > __init_Base_ = Base.__init__
> > class Derived(A1,BasePrime):
> > def __init__(self):
> > A1.__init__(self)
> > self.__init_Base_()
> > self.y = 'y'
> It works. But only if Base is root of inheritance tree. Otherwise we get
same error for all Base's ancestors.
>
> ;(((
>
> > class BasePrime(Base): pass
> > class Derived(A1,BasePrime):
> > def __init__(self):
> > A1.__init__(self)
> > BasePrime.__init__(self)
> It doesn't work at all ;(
>
> Regards, Ivan <vig_at_[hidden]>
> ICQ: 22181170
>
>
> Info: http://www.boost.org Unsubscribe:
<mailto:boost-unsubscribe_at_[hidden]>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>


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