freeradius-server
freeradius-server copied to clipboard
Fix build errors with Python 3.13
trafficstars
According to 1, the PyEval_InitThreads() (deprecated 3.9), PyEval_AcquireLock() and PyEval_ReleaseLock() (deprecated 3.2). functions, are removed in Python 3.13. Py_SetProgramName() is deprecated since 3.11 as well.
PyEval_InitThreads can be deleted if running Python >= 3.10 as it simply does nothing from Python 3.9 2.
Lock functions are replaced with PyEval_RestoreThread and PyEval_SaveThread as advised by Python docs 3, 4.
As for Py_SetProgramName, it should be replaced with PyConfig. The config is isolated to replicate behavior of InitializeEx 5.
I've done some formatting and cleanups. Please double-check.