Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/Python/Internal/Eval.hs
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,17 @@ doInitializePythonIO = do
goto error;
};
PyConfig_Clear(&cfg);
// This is hack for python<=3.11.
//
// Somehow we may end up in stet where thread ID of main thread is not equal
// to main thread's one. Importing threading seems to fix it. However exact
// reason for such behavior is unknown
if( PY_MINOR_VERSION <= 11 ) {
PyObject *threading = PyImport_ImportModule("threading");
if( PyErr_Occurred() ) {
PyErr_Clear();
}
}
// Release GIL so other threads may take it
PyEval_SaveThread();
return 0;
Expand Down
Loading