Skip to content

Fix compilation with Python 3.13.0a1

Mattias Ellert requested to merge ellert/HepMC3:python-3.13 into master

https://bugzilla.redhat.com/show_bug.cgi?id=2245854

https://github.com/pybind/pybind11/pull/4902

/builddir/build/BUILD/HepMC3-3.2.7/python/include/pybind11/detail/../detail/type_caster_base.h: In function ‘PyThreadState* pybind11::detail::get_thread_state_unchecked()’:
/builddir/build/BUILD/HepMC3-3.2.7/python/include/pybind11/detail/../detail/type_caster_base.h:565:12: error: ‘_PyThreadState_UncheckedGet’ was not declared in this scope; did you mean ‘PyThreadState_GetUnchecked’?
  565 |     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().

Merge request reports