From e59a2e909ec3b3056a640cec4bce67b91240c322 Mon Sep 17 00:00:00 2001 From: Sizhe Zhao Date: Mon, 9 Jun 2025 04:42:56 +0800 Subject: [PATCH] root5: fix building with python 3.13 (#414801) --- pkgs/by-name/ro/root5/package.nix | 4 ++++ .../ro/root5/python313-PyCFunction_Call.patch | 14 ++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 pkgs/by-name/ro/root5/python313-PyCFunction_Call.patch diff --git a/pkgs/by-name/ro/root5/package.nix b/pkgs/by-name/ro/root5/package.nix index 760eda7bb7e8..abffe178a93f 100644 --- a/pkgs/by-name/ro/root5/package.nix +++ b/pkgs/by-name/ro/root5/package.nix @@ -85,6 +85,10 @@ stdenv.mkDerivation rec { # Backport Python 3.11 fix to v5 from v6.26 # https://github.com/root-project/root/commit/484deb056dacf768aba4954073b41105c431bffc ./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 diff --git a/pkgs/by-name/ro/root5/python313-PyCFunction_Call.patch b/pkgs/by-name/ro/root5/python313-PyCFunction_Call.patch new file mode 100644 index 000000000000..a447b4760d0d --- /dev/null +++ b/pkgs/by-name/ro/root5/python313-PyCFunction_Call.patch @@ -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 );