[PyKDE] Handling exceptions in SIP
Phil Thompson
phil at riverbankcomputing.co.uk
Thu Jun 9 18:11:50 BST 2005
On Thursday 09 June 2005 5:33 pm, James Emerton wrote:
> 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++.
Seems reasonable.
Phil
More information about the PyQt
mailing list