Remove all calls to PyEval_InitThreads(), which has been deprecated since
Python 3.9 and generates compiler warnings on Python 3.13+.
Background:
-----------
PyEval_InitThreads() was used to initialize Python's GIL (Global Interpreter
Lock) and threading support. In Python 3.7+, the GIL is automatically
initialized, making this function a no-op.
From Python 3.9 source (Python/ceval.c:315-318):
void PyEval_InitThreads(void)
{
/* Do nothing */
}
The function was officially deprecated in Python 3.9:
https://docs.python.org/3/whatsnew/3.9.html
"Deprecated: PyEval_InitThreads() and PyEval_ThreadsInitialized()
are now deprecated and will be removed in Python 3.13."
As of Python 3.13, calling this function produces deprecation warnings:
warning: 'PyEval_InitThreads' is deprecated [-Wdeprecated-declarations]
Rationale:
----------
Ceph enforces a minimum Python version of 3.9 (CMakeLists.txt:630):
if(Python3_VERSION VERSION_LESS 3.9)
message(FATAL_ERROR "... please use Python 3.9 and up")
Since we require Python 3.9+, and PyEval_InitThreads() is a no-op in
Python 3.9+, these calls serve no purpose and can be safely removed.
Changes:
--------
- Removed PyEval_InitThreads() declaration from cdef extern blocks
- Removed PyEval_InitThreads() calls from __init__/__cinit__ methods