Dan Villiom Podlaski Christiansen wrote:

The relevant snippet of code in -[PyApplication sendEvent:] looks like this:

r = PyObject_CallMethod(*self*.app, "handle", "OO", kind, pyevent);

*if* (r == *NULL*) {
    PyObject_CallMethod(*self*.app, "report_error", "");
}

I'm not terribly familiar with how exceptions work with the Python API, but shouldn't that suffice?

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.)

--
Greg


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

Reply via email to