Greg Chapman wrote: > Your callback function needs to hold the Python GIL (and have a vaild > threadstate) before it calls any Python C-API functions. Change the > last part of it to: > > PyGILState_STATE state; > > /* ... */ > > /* Time to call the callback */ > > state = PyGILState_Ensure(); > > arglist = Py_BuildValue("(s)", str); > result = PyEval_CallObject(my_callback, arglist); > Py_DECREF(arglist); > if(result == NULL) > return; > Py_DECREF(result); > > PyGILState_Release(state); > }
you might wish to make sure you release the GIL even if the callback raises an exception... </F> -- http://mail.python.org/mailman/listinfo/python-list