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
[email protected]

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
Pygui mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pygui

Reply via email to