The session dictionary attached to a Python interpeter holds variables the user creates in the script interpreter
This can include objects that have complex state and need to be torn down intelligently (e.g. our SB* objects) This will fail if the Python interpreter does not hold a valid thread state. So, acquire one, delete the session dictionary, and then let go of it on destruction This fixes rdar://20960843 llvm-svn: 242745
This commit is contained in:
parent
c7ae3e03e2
commit
fbecf1ab1a
|
@ -212,6 +212,14 @@ ScriptInterpreterPython::ScriptInterpreterPython (CommandInterpreter &interprete
|
|||
|
||||
ScriptInterpreterPython::~ScriptInterpreterPython ()
|
||||
{
|
||||
// the session dictionary may hold objects with complex state
|
||||
// which means that they may need to be torn down with some level of smarts
|
||||
// and that, in turn, requires a valid thread state
|
||||
// force Python to procure itself such a thread state, nuke the session dictionary
|
||||
// and then release it for others to use and proceed with the rest of the shutdown
|
||||
auto gil_state = PyGILState_Ensure();
|
||||
m_session_dict.Reset();
|
||||
PyGILState_Release(gil_state);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Reference in New Issue