root5: fix building with python 3.13 (#414801)

This commit is contained in:
Sizhe Zhao 2025-06-09 04:42:56 +08:00 committed by GitHub
parent aeb2a13428
commit e59a2e909e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 18 additions and 0 deletions

View file

@ -85,6 +85,10 @@ stdenv.mkDerivation rec {
# Backport Python 3.11 fix to v5 from v6.26 # Backport Python 3.11 fix to v5 from v6.26
# https://github.com/root-project/root/commit/484deb056dacf768aba4954073b41105c431bffc # https://github.com/root-project/root/commit/484deb056dacf768aba4954073b41105c431bffc
./root5-python311-fix.patch ./root5-python311-fix.patch
# Backport Python 3.13 fix to v5 from v6.25
# https://github.com/root-project/root/commit/9aa67a863482eef8cf50850b9ac3724e35f58781
./python313-PyCFunction_Call.patch
]; ];
# https://github.com/root-project/root/issues/13216 # https://github.com/root-project/root/issues/13216

View file

@ -0,0 +1,14 @@
--- a/bindings/pyroot/src/TCustomPyTypes.cxx
+++ b/bindings/pyroot/src/TCustomPyTypes.cxx
@@ -240,7 +240,11 @@
// the function is globally shared, so set and reset its "self" (ok, b/c of GIL)
Py_INCREF( self );
func->m_self = self;
+#if PY_VERSION_HEX >= 0x03090000
+ PyObject* result = PyObject_Call( (PyObject*)func, args, kw );
+#else
PyObject* result = PyCFunction_Call( (PyObject*)func, args, kw );
+#endif
func->m_self = 0;
Py_DECREF( self );
Py_DECREF( args );