[PyKDE] Handling exceptions in SIP

James Emerton ephelon at gmail.com
Thu Jun 9 17:33:22 BST 2005


On 6/7/05, Phil Thompson <phil at riverbankcomputing.co.uk> wrote:
> So if I introduce something like...
> 
> %ExceptionType MyException
> %TypeHeaderCode
> #include <whatever>
> %End
> %ConvertFromTypeCode
>     // C++ code to return a PyObject instance of the exception.
>     // sipCpp (the C++ poiter) and sipException_MyException (the
>     // PyObject exception type) will be available, eg...
>     return PyObject_CallFunction(sipException_MyException, "S",
>                                  sipCpp->what());
> %End
> %End

I think there is a need for biderectional conversion of exceptions. 
I'd like to be able to throw them back into the C++.

In fact, a mechanism that could be enable to check the Python error
state after calling a Python method from C++ could throw the exception
instead of returning to the C++.

James




More information about the PyQt mailing list