Bug 2250652

Summary: gdb fails to build with Python 3.13: error: ‘_PyOS_ReadlineTState’ was not declared in this scope; did you mean ‘PyOS_Readline’
Product: [Fedora] Fedora Reporter: Karolina Surma <ksurma>
Component: gdbAssignee: Alexandra Petlanová Hájková <ahajkova>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: ahajkova, fweimer, guinevere, jan, keiths, kevinb, ksurma, mcermak, mhroncok, mjg, mkolar, vstinner
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: gdb-14.1-2.fc40 gdb-14.1-4.fc39 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-01-10 18:25: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-11-20 11:00:10 UTC
gdb fails to build with Python 3.13.0a1.

This report is automated and not very verbose, but we'll try to get back here with details.

../../gdb/python/py-gdb-readline.c: In function ‘char* gdbpy_readline_wrapper(FILE*, FILE*, const char*)’:
../../gdb/python/py-gdb-readline.c:59:29: error: ‘_PyOS_ReadlineTState’ was not declared in this scope; did you mean ‘PyOS_Readline’?
   59 |       PyEval_RestoreThread (_PyOS_ReadlineTState);
      |                             ^~~~~~~~~~~~~~~~~~~~
      |                             PyOS_Readline

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/06660789-gdb/

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

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 Miro Hrončok 2023-11-20 11:10:15 UTC
_PyOS_ReadlineTState was removed in https://github.com/python/cpython/pull/107034

Victor, what should gdb use instead?

Comment 2 Victor Stinner 2023-11-27 10:54:28 UTC
Oh, another surprising side effect of removing private APIs. I created https://github.com/python/cpython/issues/112446 upstream to discuss the issue. Right now, I don't know what is a good replacement.

Comment 3 Victor Stinner 2023-12-12 11:24:42 UTC
I discussed the issue in private with aburgess directly who worked on a fix using PyGILState_Ensure() and PyGILState_Release() when gdb readline callbacks has to set an exception.

Comment 4 Fedora Update System 2024-01-07 20:41:50 UTC
FEDORA-2024-775c2c657f has been submitted as an update to Fedora 38. https://bodhi.fedoraproject.org/updates/FEDORA-2024-775c2c657f

Comment 5 Fedora Update System 2024-01-08 02:24:05 UTC
FEDORA-2024-775c2c657f has been pushed to the Fedora 38 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2024-775c2c657f`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2024-775c2c657f

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 6 Karolina Surma 2024-01-08 09:02:37 UTC
Reopening, as the linked update doesn't apply to this bugzilla (F38 vs Rawhide). gdb 14.1 still doesn't build with Python 3.13 with the above failure.

Comment 7 Miro Hrončok 2024-01-10 18:25:01 UTC
Works, thanks.

Comment 8 Fedora Update System 2024-01-30 09:52:27 UTC
FEDORA-2024-8f10f96169 has been submitted as an update to Fedora 39. https://bodhi.fedoraproject.org/updates/FEDORA-2024-8f10f96169

Comment 9 Fedora Update System 2024-01-31 00:52:15 UTC
FEDORA-2024-8f10f96169 has been pushed to the Fedora 39 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2024-8f10f96169`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2024-8f10f96169

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 10 Fedora Update System 2024-02-05 01:25:32 UTC
FEDORA-2024-8f10f96169 has been pushed to the Fedora 39 stable repository.
If problem still persists, please make note of it in this bug report.