[Python-Dev] thread issues when embedding Python

Daniel Pocock daniel at pocock.com.au
Wed Dec 18 22:58:27 CET 2013



On 18/12/13 16:29, Victor Stinner wrote:
> 2013/12/18 Antoine Pitrou <solipsis at pitrou.net>:
>> You only need to call PyEval_InitThreads() once in the main Python
>> thread.
> 
> This is not well documented. For your information, PyGILState_Ensure()
> now calls PyEval_InitThreads() in Python 3.4, see:
> http://bugs.python.org/issue19576


I did see that - but from my own experience, I do not believe it is
calling PyThreadState_New(..) and it is not even checking if
PyThreadState_New(..) has ever been called for the active thread

Consequently, the thread is blocked or there is a seg fault

I've now written up a much more thorough overview of my experience on my
blog:

http://danielpocock.com/embedding-python-multi-threaded-cpp


More information about the Python-Dev mailing list