Francois De Serres <[EMAIL PROTECTED]> writes:

> Hello,
>
> I'm chasing a GPF in the interpreter when running my extension module.
> It's not very elaborated, but uses a system (threaded) callback, and
> therefore the GIL.
> Help would be mucho appreciated. Here's the rough picture:
>

> static void external_callback(const Bag * const bag) {       if
> (my_callback && (my_callback != Py_None)) {
>         PyObject * arglist = NULL;
>         PyObject * result = NULL;
>         arglist = Py_BuildValue("(s#)", bag->data, bag->size);
>           /* do it */
>         PyGILState_STATE gil = PyGILState_Ensure();

You're calling Py_BuildValue without holding the GIL.  Not sure if
that's the reason for your problems, but I don't think its ok.

>         result = PyEval_CallObject(my_callback, arglist);
>         PyGILState_Release(gil);
>                   Py_DECREF(arglist);
>         Py_DECREF(result);      }
> }

Thomas
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to