diff --git a/root-pyroot-add-python-3.13-attributes.patch b/root-pyroot-add-python-3.13-attributes.patch new file mode 100644 index 0000000..9ba3149 --- /dev/null +++ b/root-pyroot-add-python-3.13-attributes.patch @@ -0,0 +1,62 @@ +From 4d1486b95cd8c7850b12bd1777ea4463529f0b96 Mon Sep 17 00:00:00 2001 +From: Mattias Ellert +Date: Sat, 8 Jun 2024 17:08:48 +0200 +Subject: [PATCH] [pyroot] Add __firstlineno__ and __static_attributes__ to + blacklist + +For compatibility with Python 3.13 + +See: https://docs.python.org/3.13/whatsnew/3.13.html + +From the above page: + +* Classes have a new __firstlineno__ attribute, populated by the + compiler, with the line number of the first line of the class + definition. (Contributed by Serhiy Storchaka in gh-118465.) + +* Classes have a new __static_attributes__ attribute, populated by the + compiler, with a tuple of names of attributes of this class which + are accessed through self.X from any function in its + body. (Contributed by Irit Katriel in gh-115775.) + +Without adding the new attributes to the blacklist there are errors: + +AttributeError: 'int' object attribute 'doc' is read-only +from the __firstlineno__ attribute. + +AttributeError: 'tuple' object attribute 'doc' is read-only +from the __static_attributes__ attribute. +--- + .../python/ROOT/_pythonization/_roofit/__init__.py | 2 +- + .../pythonizations/python/ROOT/_pythonization/_tmva/__init__.py | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/bindings/pyroot/pythonizations/python/ROOT/_pythonization/_roofit/__init__.py b/bindings/pyroot/pythonizations/python/ROOT/_pythonization/_roofit/__init__.py +index 83b3b69e3b..4ebd53736d 100644 +--- a/bindings/pyroot/pythonizations/python/ROOT/_pythonization/_roofit/__init__.py ++++ b/bindings/pyroot/pythonizations/python/ROOT/_pythonization/_roofit/__init__.py +@@ -122,7 +122,7 @@ def get_defined_attributes(klass, consider_base_classes=False): + any of its base classes (except for `object`). + """ + +- blacklist = ["__dict__", "__doc__", "__hash__", "__module__", "__weakref__"] ++ blacklist = ["__dict__", "__doc__", "__hash__", "__module__", "__weakref__", "__firstlineno__", "__static_attributes__"] + + if not consider_base_classes: + return sorted([attr for attr in klass.__dict__.keys() if attr not in blacklist]) +diff --git a/bindings/pyroot/pythonizations/python/ROOT/_pythonization/_tmva/__init__.py b/bindings/pyroot/pythonizations/python/ROOT/_pythonization/_tmva/__init__.py +index b2dea5b541..72c210663d 100644 +--- a/bindings/pyroot/pythonizations/python/ROOT/_pythonization/_tmva/__init__.py ++++ b/bindings/pyroot/pythonizations/python/ROOT/_pythonization/_tmva/__init__.py +@@ -69,7 +69,7 @@ def get_defined_attributes(klass, consider_base_classes=False): + any of its base classes (except for `object`). + """ + +- blacklist = ["__dict__", "__doc__", "__hash__", "__module__", "__weakref__"] ++ blacklist = ["__dict__", "__doc__", "__hash__", "__module__", "__weakref__", "__firstlineno__", "__static_attributes__"] + + if not consider_base_classes: + return sorted([attr for attr in klass.__dict__.keys() if attr not in blacklist]) +-- +2.45.2 + diff --git a/root.spec b/root.spec index c39adee..8ae9e2f 100644 --- a/root.spec +++ b/root.spec @@ -26,7 +26,7 @@ Name: root Version: 6.32.00 %global libversion %(cut -d. -f 1-2 <<< %{version}) -Release: 1%{?dist} +Release: 2%{?dist} Summary: Numerical data analysis framework License: LGPL-2.1-or-later @@ -81,6 +81,10 @@ Patch9: %{name}-out-of-bounds.patch # Fix one more broken import in JsMVA # https://github.com/root-project/root/pull/15752 Patch10: %{name}-fix-one-more-broken-import-in-JsMVA.patch +# Python 3.13 compatibility +# https://github.com/root-project/root/issues/15430 +# https://github.com/root-project/root/pull/15798 +Patch11: %{name}-pyroot-add-python-3.13-attributes.patch BuildRequires: gcc-c++ BuildRequires: gcc-gfortran @@ -1926,6 +1930,7 @@ This package contains utility functions for ntuples. %patch -P8 -p1 %patch -P9 -p1 %patch -P10 -p1 +%patch -P11 -p1 # Remove bundled sources in order to be sure they are not used # * afterimage @@ -2497,6 +2502,14 @@ tutorial-pyroot-pyroot004_NumbaDeclare-py|\ pyunittests-pyroot-numbadeclare|\ test-webgui-ping" +%if %{?fedora}%{!?fedora:0} >= 41 +# - pyunittests-pyroot-pyz-ttree-setbranchaddress +# Segfault with Python 3.13: +# https://github.com/root-project/root/issues/15799 +excluded="${excluded}|\ +pyunittests-pyroot-pyz-ttree-setbranchaddress" +%endif + %if ! %{pandas} # - test-import-pandas # - tutorial-dataframe-df026_AsNumpyArrays-py @@ -3557,6 +3570,9 @@ fi %endif %changelog +* Sat Jun 08 2024 Mattias Ellert - 6.32.00-2 +- Python 3.13 compatibility + * Mon Jun 03 2024 Mattias Ellert - 6.32.00-1 - Update to 6.32.00 - Drop EPEL 8 build (now requires Python >= 3.7 ans tbb >= 2020)