[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: Re: [PyQt] Re: New bug in SIP
From: Phil Thompson <phil () riverbankcomputing ! com>
Date: 2008-05-30 18:23:43
Message-ID: 200805301923.43475.phil () riverbankcomputing ! com
[Download RAW message or body]
On Friday 30 May 2008 2:30:59 pm Phil Thompson wrote:
> On Friday 30 May 2008 1:05:11 pm Giovanni Bajo wrote:
> > On 5/30/2008 12:32 PM, Phil Thompson wrote:
> > > On Wednesday 28 May 2008 3:39:11 pm Giovanni Bajo wrote:
> > >> Hi Phil,
> > >>
> > >> I found a new bug in SIP (it used to work with a SIP from September
> > >> 2007).
> > >>
> > >> If you declare a class with a single constructor, you write
> > >> %MethodCode for that constructor, and you make it raise an exception
> > >> (PyErr_Format) and set sipIsErr=1, the exception is not propagated to
> > >> Python: it gets "swallowed" and changed into an AttributeError which
> > >> says "... is a private method".
> > >>
> > >> Basically, this code in sipWrapper_init, line 7173:
> > >>
> > >> /*
> > >> * If the arguments were parsed without error then
> > >> assume an * exception has already been raised for why the instance *
> > >> wasn't created.
> > >> */
> > >> if (pstate == PARSE_OK)
> > >> argsparsed = PARSE_RAISED;
> > >>
> > >>
> > >> is not executed, because pstate was already mutated a few lines above:
> > >>
> > >>
> > >> /*
> > >> * If the parse was successful but no C/C++ object was
> > >> created then
> > >> * we assume that handwritten code decided after the
> > >> parse that * it didn't want to handle the signature.
> > >> */
> > >> if (pstate == PARSE_OK)
> > >> pstate = PARSE_TYPE;
> > >>
> > >>
> > >> I was wondering if it should check "argsparsed == PARSE_OK" (at line
> > >> 7173) instead of "pstate == PARSE_OK".
> > >>
> > >> Thanks!
> > >
> > > I think the bug is that the earlier code should be...
> > >
> > > if (pstate == PARSE_OK)
> > > pstate = argsparsed = PARSE_TYPE;
> >
> > This changes the exception into a TypeError (eg: "argument 1 has an
> > invalid type"), but it still mask the original exception that was raised
> > in the %MethodCode.
>
> Hmm - I need to think about this a bit more. It's all related to the
> QVariant support for Python objects.
Hopefully fixed in tonight's snapshot.
Phil
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic