Tim Roberts wrote: >>> PyGILState_STATE gil = PyGILState_Ensure(); >>> result = PyEval_CallObject(my_callback, arglist); >>> PyGILState_Release(gil); >>> Py_DECREF(arglist); >>> Py_DECREF(result);
> If someone else holds a reference to "arglist", then the > DECREF is just a nice, atomic decrement. If no one else holds a reference > to "arglist", then it's quite safe to delete it. What if anothere thread takes the GIL as soon as you release it, and is attempting to allcate a new opbject, and (at the same time - you might be on a multiprocessor!) your PyDECREF removes the last reference and starts freeing objects? -- http://mail.python.org/mailman/listinfo/python-list