More than one interpreter per process?

Roger Binns rogerb at rogerbinns.com
Tue Dec 18 23:07:01 EST 2007


Graham Dumpleton wrote:
> When using mod_wsgi there is no problem with C extension modules which
> use simplified GIL API provided that one configures mod_wsgi to
> delegate that specific application to run in the context of the first
> interpreter instance created by Python.

Graham, I've asked you before but never quite got a straight answer.
What *exactly* should extension authors change their code to in order to
be fully compatible?  For example how should the C function below be
changed:

void somefunc(void)
{
  PyGILState_STATE gilstate=PyGILState_Ensure();

  abc();

  Py_BEGIN_ALLOW_THREADS
     def();
  Py_END_ALLOW_THREADS

  ghi();

  PyGILState_Release(gilstate);
}

Roger



More information about the Python-list mailing list