Python 3.11 will remove the functions that initialize the threading support: https://docs.python.org/3.9/c-api/init.html#c.PyEval_InitThreads
The threading support init work is done automatically as part of Py_Initialize since Python 3.7. With Python 3.9
the functions are now also no-ops and marked as deprecated to warn users[1].
This patch reworks the current initialization code so that it hopefully compiles and does the
right thing for all Python versions:
- Python<3.7 we keep the old behaviour.
- Python>3.7 we don't do any calls to the potentially deleted functions and just try to acquire the GIL to preserve the side-effect of the old implementation.
[1] We disabled deprecation warnings globally in LLDB so that's why we didn't see this yet.
clang-tidy: error: 'lldb/Host/Config.h' file not found [clang-diagnostic-error]
not useful