[pygtk] PyGtk_FatalExceptions replacement?
Johan Dahlin
jdahlin at async.com.br
Tue Jan 31 05:38:58 WST 2006
Andrew Reid wrote:
> Hi all --
>
> We're in the process of cleaning up the port of our application
> from pygtk-0.6.9 to pygtk-2.6.1. Most things transferred over
> in a reasonably straightforward way, but there's an issue we put
> off, and I'm not sure how to handle it.
>
> We have some mouse callbacks from a GtkCanvas, which are handled
> in C++ code, which then calls out to Python to run a handler.
> In the pygtk-0.6.9 version, there's an fatal-error check in the C++
> handler, like this: (The example is actually from the config callback,
> but the mouse-event ones are similar)
>
>> void CanvasObj::configure_event_callback( ... ) {
>> PyGILState_STATE state = (PyGILState_STATE) pyg_gil_state_ensure();
>> try {
>> PyObject *args = Py_BuildValue("iiii",
>> (int)(a->x), (int)(a->y),
>> (int)(a->width), (int)(a->height));
>> if (args) {
>> // Call the Python handler for the configuration event...
>> PyObject *result = PyObject_CallObject(config_callback, args);
>> if (result==NULL) {
>> if (PyGtk_FatalExceptions) { // <--- ERROR CHECK IS HERE
Just calling if (PyErr_Occurred()) should be fine here.
- A.
More information about the pygtk
mailing list