(Win32 API) callback to Python, threading hiccups
Scott David Daniels
Scott.Daniels at Acm.Org
Thu Jul 7 11:47:15 EDT 2005
Francois De Serres wrote:
> PyGILState_STATE gil = PyGILState_Ensure();
> result = PyEval_CallObject(my_callback, arglist);
> PyGILState_Release(gil);
> Py_DECREF(arglist);
> Py_DECREF(result);
I think this should be:
PyGILState_STATE gil = PyGILState_Ensure();
result = PyEval_CallObject(my_callback, arglist);
Py_DECREF(arglist);
Py_DECREF(result);
PyGILState_Release(gil);
The DECREFs need to be protected, that is where storage is
recycled and such, and you still need Python's data structures
to do that kind of work.
--Scott David Daniels
More information about the Python-list
mailing list