extension call backs and the GIL

Bernhard Herzog bh at intevation.de
Mon Sep 29 14:48:54 CEST 2003

Robin Becker <robin at jessikat.fsnet.co.uk> writes:

>>You need to reacquire the GIL prior to making the callback.
> So does calling an extension release the GIL?

No. It would be very inconvenient if it did because what most functions
do first is to call one of the PyArg_ParseTuple functions which could
execute arbitrary python code.

I think it would help if you described a bit more what the actual
problem is or what the user does. 

I looked briefly at the sources and assuming tha the accelerator in
question is lib/_rl_accel.c and the callback whatever has been assigned
to _SWRecover, could it be that the problem is that your user tries to
use different callbacks in different threads? _SWRecover is a global
after all and shared by all threads.


Intevation GmbH                                 http://intevation.de/
Sketch                                 http://sketch.sourceforge.net/
Thuban                                  http://thuban.intevation.org/

More information about the Python-list mailing list