[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyQt] SIP: passing exceptions Python -> C++
From:       "Jim Crowell" <jaclists () mailbolt ! com>
Date:       2008-04-29 15:43:36
Message-ID: 1209483816.4126.1250498969 () webmail ! messagingengine ! com
[Download RAW message or body]

> From: Phil Thompson <phil@riverbankcomputing.com>
> Subject: Re: [PyQt] SIP: passing exceptions Python -> C++
>
> > I've got a C++ class with a whole bunch of virtual methods that are
> > overridden in Python subclasses.
> >
> > These methods are callbacks, i.e. they're called repeatedly from a C++
> > event loop.
> >
> > I want to catch any Python exceptions raised in any of these callbacks,
> > print the error messages, and then raise a C++ exception that will cause
> > the event loop to exit.
> >
> > Is there an elegant way to do this without essentially re-implementing
> > all of the nice stuff that handles calling virtual methods? It looks
> > like all of the existing exception-mapping stuff is for going the other
> > direction, i.e. from C++ -> Python.
> 
> I'm afraid so. One for the TODO list.
> 
> Phil

OK, thanks. Turned out there was a method that accomplished the same
thing as throwing the C++ exception, so I was able to get it done with a
Python wrapper class.

-Jim C.
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic