[PyQt] Problem catching exception from SIP-wrapped function

Phil Thompson phil at riverbankcomputing.com
Tue Sep 22 18:27:16 BST 2009


On Tue, 22 Sep 2009 19:17:12 +0200, Arve Knudsen <arve.knudsen at gmail.com>
wrote:
> On Tue, Sep 22, 2009 at 6:28 PM, Phil Thompson
> <phil at riverbankcomputing.com>wrote:
> 
>> On Mon, 21 Sep 2009 18:40:35 +0200, Arve Knudsen
<arve.knudsen at gmail.com>
>> wrote:
>> > Hi
>> >
>> > I have run into this problem where a C++ exception is not correctly
>> > translated into Python on Linux (it works under VC++ on Windows). The
>> > exception is apparently not caught as it should, but looking at the
>> > SIP-generated sourcecode I cannot see why (there is a try/catch block
>> > for
>> > the exception). Any ideas as to what might be going wrong here? I have
>> > tried
>> > std::exception instead of my custom exception, and this gets
translated
>> > correctly to Python.
>> >
>> > Attached I have a simple library 'raiser', which is wrapped by the
>> > Python
>> > module 'raiser'. In order to build it, first build a shared library
>> > from
>> > 'raiser.cpp', then run 'configure.py' and make.
>>
>> Works fine for me on Linux with the current SIP snapshot. I did change
>> your
>> code first to make everything in-line so it wasn't necessary to build a
>> separate library.
> 
> 
> By inlining you remove the problem of interest, which is to propagate an
> exception from one library to another. It also works for me when
inlining,
> so try my original version please.

That implies it's a build system issue. Can you send me the Makefile you
are using to build the library so that I know I'm exactly reproducing what
you are doing.

Phil


More information about the PyQt mailing list