Its getting kind of late and my eyes are getting tired so I wanted to throw up this problem I am having and see if I can get some feedback on what might be going wrong here.
I built boost::python into my app and exported a bunch of stuff. All is well when I just call functions and do not much at all (the example apps all work for example). However, when I start actually trying to use the features of my library I crash python. In debug mode I get a ton of "PyThreadState_Get: no current thread" messages printed before it crashes from what I assume is a stack overflow. In release mode it just crashes. Both crash while executing Py_ALLOW_RECURSION t = PyDict_GetItem(interned, (PyObject *)s); Py_END_ALLOW_RECURSION in unicodeobject.c line 9725 The stack trace once the program enters the python dll looks like this (going bottom to up) python31_d.dll!Py_FatalError(const char * msg=0x000007fef0c350f8) Line 2013 + 0x5 bytes C python31_d.dll!PyThreadState_Get() Line 351 C python31_d.dll!PyErr_Occurred() Line 133 + 0x5 bytes C python31_d.dll!Py_FatalError(const char * msg=0x000007fef0c350f8) Line 2013 + 0x5 bytes C python31_d.dll!PyThreadState_Get() Line 351 C python31_d.dll!PyUnicode_InternInPlace(_object * * p=0x000000000330ef18) Line 9725 + 0x5 bytes C python31_d.dll!PyUnicode_InternFromString(const char * cp=0x000007fef113ef28) Line 9766 C python31_d.dll!PyObject_GetAttrString(_object * v=0x000000000245f658, const char * name=0x000007fef113ef28) Line 751 + 0xa bytes C i have a suspicion about what may be causing this error but I am afraid I do not know enough about python to know for sure, so here where you guys come in :) My program ( that python is controlling ) is multithreaded. I am thinking that one of the other program threads is calling a python method and that is what is causing this crash. I am using the observer pattern in my design and I have a python object that I attach to an object to watch for changes. When the object is changed, my python code should get executed. The notify method to tell all the observers there was a change could get called from a separate thread. I am pretty sure I have wrapped the classes and definitions correctly to allow this to happen thanks to the boost::python doc. So my question is, would calling python code from a thread other than the main thread cause this problem? And if so, how can I fix this? Thank you for your time
_______________________________________________ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig