[PyKDE] Sip does not wrap static const members of mapped type?

Phil Thompson phil at riverbankcomputing.co.uk
Fri Apr 21 13:00:49 BST 2006


On Friday 21 April 2006 12:54 pm, Jacob M. Burbach wrote:
> On Friday 21 April 2006 7:26, Phil Thompson wrote:
> > On Friday 21 April 2006 12:02 pm, Jacob M. Burbach wrote:
> > > On Thursday 20 April 2006 6:15, Phil Thompson wrote:
> > > > On Tuesday 18 April 2006 5:14 am, Jacob M. Burbach wrote:
> > > > > I'm wrapping some classes and find that Sip will not wrap static
> > > > > const members that are defined as a MappedType. Standard types,
> > > > > wrapped types, and non const members are wrapped ok, just not const
> > > > > mapped types. This seems like a bug in sip?
> > > >
> > > > Yes - should be fixed in tonight's snapshot (although not heavily
> > > > tested).
> > > >
> > > > Phil
> > >
> > > Thats seems to do the trick, but introduced another bug(a typo really I
> > > think). In sipgen/gencode.c, function `generateInternalAPIHeader',
> > > there is not enough `mname' entries to fill out the format string(needs
> > > one more).
> >
> > Yes - thanks.
> >
> > > One other question about ownership, and how it gets transferred in
> > > regards to methods that throw. Basically, If I have method:
> > >
> > > void someMethod(Something* s /Transfer/) throw(Whatever);
> > >
> > > what happens to the ownership if the method throws? Is it still
> > > transferred? Do I need to put handwritten code to catch and transfer
> > > back?
> >
> > I'm afraid so, but it's a bit of a can of worms. You need to transfer
> > ownership back to the previous owner - but you don't know who that was.
> >
> > Phil
>
> Hmm, I guess I should just leave out the `/Transfer/' and put hand written
> code that only takes ownership if the call succeeds then?

That depends on your library. SIP doesn't have the ability to conditionally 
transfer ownership - for example based on the return value or whether an 
exception was thrown or not (or which exception was thrown). Perhaps it 
should have, but not any time soon.

Phil




More information about the PyQt mailing list