[PyQt] Problem with exception translation

Phil Thompson phil at riverbankcomputing.com
Tue Sep 14 13:46:27 BST 2010


On Tue, 14 Sep 2010 12:21:40 +0200, Hans Meine
<meine at informatik.uni-hamburg.de> wrote:
> On Tuesday 14 September 2010 11:51:09 Phil Thompson wrote:
>> <meine at informatik.uni-hamburg.de> wrote:
>> > Anyhow, now I found the /Default/ annotation, which is exactly what I
>> > want. However, I get compile errors from the generated code;
obviously,
>> > the above %TypeHeaderCode is not inserted into every file using the
>> > above
>> > default-catch block, so #include <exception> is missing and the build
>> > fails.
>> > 
>> > At least the latter seems to be a clear bug to me, no?
>> 
>> In the above Foo doesn't have a %TypeHeaderCode block. I would expect
>> that
>> it's .h file would #include <exception>...
>> 
>> ...unless exceptions in a throw() can be only partially defined (like
>> pointers to classes can)?
> 
> Ah, I see.  Don't know about the latter; actually, I only added
throw(..) 
> clauses to the .sip file in order to let SIP generate the try..catch.
> My original header file still does not contain information about
> exceptions, 
> so only the corresponding .cxx file #includes <exception>.
> 
> Maybe I abused SIP; in the meantime, I got used to specifying stuff
quite 
> differently in the .sip files than in the .h files.

There is no problem with telling lies to SIP, but you have to be
consistent with those lies. In this case you should add #include
<exception> to Foo's %TypeHeaderCode block.

Phil


More information about the PyQt mailing list