Swig wraps C++ code into SWIG_PYTHON_THREAD_BEGIN_ALLOW; ... SWIG_PYTHON_THREAD_END_ALLOW;
Thus, lldb crashs with "Fatal Python error: Python memory allocator called without holding the GIL" when calls lldb_SB***___str__ function.
Details
Diff Detail
- Repository
- rLLDB LLDB
Event Timeline
%feature("nothreadallow") looks more appropriate in this case. GetDescription method is quite cheap, no need to handle the GIL.
Not sure about this one. IIUC we now wouldn't take the GIL for these functions now and hope that the str() function doesn't do something that would require thread safety?
Yes, and %feature("nothreadallow") doesn't allow to release GIL before calling these functions - it prevents Swig from wrapping them into SWIG_PYTHON_THREAD_BEGIN_ALLOW .. SWIG_PYTHON_THREAD_END_ALLOW block.
I have a third party module which implements a custom command for LLDB. The command calls str(target), str(process), etc. for logging.
Anyway, every call to these functions will cause this crash to happen, because PythonString is allocated after releasing the lock.