Bug 2245785

Summary: freeradius fails to build with Python 3.13: error: implicit declaration of function ‘PyEval_InitThreads’, 'PyEval_AcquireLock', 'PyEval_ReleaseLock'
Product: [Fedora] Fedora Reporter: Karolina Surma <ksurma>
Component: freeradiusAssignee: Antonio Torres <antorres>
Status: CLOSED NEXTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 40CC: alexander.m.scheel, antorres, ksurma, lemenkov, mhroncok, nikolai.kondrashov
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: freeradius-3.2.5-2.fc41 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-09-04 15:49:01 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2244836    

Description Karolina Surma 2023-10-24 07:27:30 UTC
freeradius fails to build with Python 3.13.0a1.

src/modules/rlm_python3/rlm_python3.c: In function ‘python_interpreter_free’:
src/modules/rlm_python3/rlm_python3.c:683:9: error: implicit declaration of function ‘PyEval_AcquireLock’; did you mean ‘PyEval_AcquireThread’? [-Werror=implicit-function-declaration]
  683 |         PyEval_AcquireLock();
      |         ^~~~~~~~~~~~~~~~~~
      |         PyEval_AcquireThread
src/modules/rlm_python3/rlm_python3.c:686:9: error: implicit declaration of function ‘PyEval_ReleaseLock’; did you mean ‘PyEval_ReleaseThread’? [-Werror=implicit-function-declaration]
  686 |         PyEval_ReleaseLock();
      |         ^~~~~~~~~~~~~~~~~~
      |         PyEval_ReleaseThread
src/modules/rlm_python3/rlm_python3.c: In function ‘python_interpreter_init’:
src/modules/rlm_python3/rlm_python3.c:1123:25: error: implicit declaration of function ‘Py_SetProgramName’; did you mean ‘Py_GetProgramName’? [-Werror=implicit-function-declaration]
 1123 |                         Py_SetProgramName(name);                /* The value of argv[0] as a wide char string */
      |                         ^~~~~~~~~~~~~~~~~
      |                         Py_GetProgramName
src/modules/rlm_python3/rlm_python3.c:1136:17: error: implicit declaration of function ‘PyEval_InitThreads’; did you mean ‘PyEval_SaveThread’? [-Werror=implicit-function-declaration]
 1136 |                 PyEval_InitThreads();                   /* This also grabs a lock (which we then need to release) */
      |                 ^~~~~~~~~~~~~~~~~~
      |                 PyEval_SaveThread


According to https://docs.python.org/3.13/whatsnew/3.13.html:

- Remove PyEval_InitThreads() and PyEval_ThreadsInitialized() functions, deprecated in Python 3.9. Since Python 3.7, Py_Initialize() always creates the GIL:
calling PyEval_InitThreads() did nothing and PyEval_ThreadsInitialized() always returned non-zero.
(Contributed by Victor Stinner in https://github.com/python/cpython/issues/105182.)

- Remove PyEval_AcquireLock() and PyEval_ReleaseLock() functions, deprecated in Python 3.2. They didn’t update the current thread state. They can be replaced with:
    PyEval_SaveThread() and PyEval_RestoreThread();
    low-level PyEval_AcquireThread() and PyEval_RestoreThread();
    or PyGILState_Ensure() and PyGILState_Release().
(Contributed by Victor Stinner in gh-105182.)

https://docs.python.org/3.13/whatsnew/3.13.html

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.13/fedora-rawhide-x86_64/06546780-freeradius/

For all our attempts to build freeradius with Python 3.13, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.13/package/freeradius/

Testing and mass rebuild of packages is happening in copr.
You can follow these instructions to test locally in mock if your package builds with Python 3.13:
https://copr.fedorainfracloud.org/coprs/g/python/python3.13/

Let us know here if you have any questions.

Python 3.13 is planned to be included in Fedora 41.
To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.13.
A build failure prevents us from testing all dependent packages (transitive [Build]Requires),
so if this package is required a lot, it's important for us to get it fixed soon.

We'd appreciate help from the people who know this package best,
but if you don't want to work on this now, let us know so we can try to work around it on our side.

Comment 1 Antonio Torres 2023-10-25 07:20:12 UTC
Upstream PR https://github.com/FreeRADIUS/freeradius-server/pull/5208

Comment 2 Aoife Moloney 2024-02-15 23:00:39 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 40 development cycle.
Changing version to 40.