Reentrancy of Python interpreter

Brad Johnson Brad.Johnson at ballardtech.com
Mon Oct 1 20:45:24 CEST 2007


 <bvukov <at> yahoo.com> writes:

> Looks like ( from PyThreadStage_Get error ) that you lost the GIL. You
> probably
> entered some C++ code and encapsulated you're work in the
> 
> Py_BEGIN_ALLOW_THREADS
> <code>
> Py_END_ALLOW_THREADS
> 
> but you're <code> is calling back the Python function, and you forgot
> to acquire
> back the GIL.
> 

I didn't explicitly allow for threads in Python. It should just be single
threaded. So I don't understand why I should have to acquire the GIL for the
second call into the interpreter, or how I lost the GIL in the first place.

Maybe I just need the second call to be placed into its own thread...?





More information about the Python-list mailing list