[Pygui] Native wrappers?
Dan Villiom Podlaski Christiansen
danchr at gmail.com
Mon Dec 21 10:53:13 CET 2009
On 21 Dec 2009, at 00:55, Greg Ewing wrote:
> No. Catching and handling exceptions in C code is rather tricky,
> especially if you want Python code to subsequently access the
> exception using sys.exc_info(), which is what report_error()
> is trying to do.
>
> I don't have time right now to explain in detail what needs to
> be done. In the meantime I suggest you just call PyErr_WriteUnraisable
> if you get an exception in a context where you can't propagate it to
> the caller.
>
> (BTW, this would be another good reason to use Pyrex -- it takes
> care of all the gory details of exception handling for you.)
Looking at the Pyrex code, I figured out how to get it working :) Essentially, setting the exception fields in the thread state did the trick.[1] There may be more to it, but at least it works for now…
[1] This is the relevant changeset: <https://bitbucket.org/danchr/pygui/changeset/d2c36d5fdd82/>
--
Dan Villiom Podlaski Christiansen
danchr at gmail.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1943 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/pygui/attachments/20091221/d08dbbe8/attachment.bin>
More information about the Pygui
mailing list