Bug 2245864

Summary: pybind11 fails with Python 3.13: error: ‘_PyThreadState_UncheckedGet’ was not declared in this scope; did you mean ‘PyThreadState_GetUnchecked’?
Product: [Fedora] Fedora Reporter: Karolina Surma <ksurma>
Component: pybind11Assignee: Susi Lehtola <susi.lehtola>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: jonathan, ksurma, logans, mattias.ellert, mhroncok, negativo17, susi.lehtola, thofmann
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-10-27 09:36:53 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 11:46:27 UTC
orocos-kdl fails to build with Python 3.13.0a1.

/usr/include/pybind11/detail/type_caster_base.h:490:12: error: ‘_PyThreadState_UncheckedGet’ was not declared in this scope; did you mean ‘PyThreadState_GetUnchecked’?
  490 |     return _PyThreadState_UncheckedGet();
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
      |            PyThreadState_GetUnchecked

/usr/include/pybind11/detail/type_caster_base.h: In function ‘PyThreadState* pybind11::detail::get_thread_state_unchecked()’:
/usr/include/pybind11/detail/type_caster_base.h:490:12: error: ‘_PyThreadState_UncheckedGet’ was not declared in this scope; did you mean ‘PyThreadState_GetUnchecked’?
  490 |     return _PyThreadState_UncheckedGet();
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
      |            PyThreadState_GetUnchecked

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

Add PyThreadState_GetUnchecked() function: similar to PyThreadState_Get(), but don’t kill the process with a fatal error if it is NULL.
The caller is responsible to check if the result is NULL.
Previously, the function was private and known as _PyThreadState_UncheckedGet().
(Contributed by Victor Stinner in gh-108867.)

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

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

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 Mattias Ellert 2023-10-26 15:53:48 UTC
Consider backporting the following commit from pybind11:

https://github.com/pybind/pybind11/commit/fa27d2fd439cd84a749e2759c0dd21529fac50a4

Comment 2 Miro Hrončok 2023-10-27 09:22:49 UTC
(In reply to Mattias Ellert from comment #1)
> Consider backporting the following commit from pybind11:
> 
> https://github.com/pybind/pybind11/commit/
> fa27d2fd439cd84a749e2759c0dd21529fac50a4

https://src.fedoraproject.org/rpms/pybind11/pull-request/9

Building in copr, will rebuild orocos-kdl afterwards.