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!
--
Giovanni Bajo
Develer S.r.l.
http://www.develer.com
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to