From b256864458cd4e9eeacf0d5f66d7da0327b77b8f406b126d7f90f639469cf08b Mon Sep 17 00:00:00 2001 From: Dirk Mueller <dmueller@suse.com> Date: Sun, 1 Sep 2024 16:48:59 +0000 Subject: [PATCH] - Add patch numpy-2.1-support.patch, numpy-2.1-interval.patch: OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-pythran?expand=0&rev=52 --- numpy-2.1-interval.patch | 33 +++++++++++++++++++++++++++++++++ python-pythran.changes | 2 +- python-pythran.spec | 1 + 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 numpy-2.1-interval.patch diff --git a/numpy-2.1-interval.patch b/numpy-2.1-interval.patch new file mode 100644 index 0000000..54b9062 --- /dev/null +++ b/numpy-2.1-interval.patch @@ -0,0 +1,33 @@ +From 6b61e8a6b3dddab13b88e51309cbdf2f28247960 Mon Sep 17 00:00:00 2001 +From: serge-sans-paille <serge.guelton@telecom-bretagne.eu> +Date: Thu, 22 Aug 2024 08:20:25 +0200 +Subject: [PATCH] Fix docstring and implementation of Interval.power + +This makes the code more resilient to future numpy changes. +--- + pythran/interval.py | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/pythran/interval.py b/pythran/interval.py +index 4e5dff8fd..b8ef42e69 100644 +--- a/pythran/interval.py ++++ b/pythran/interval.py +@@ -196,13 +196,15 @@ def __pow__(range1, range2): + >>> Interval(1, 5) ** Interval(-5, -4) + Interval(low=1.0, high=1.0) + >>> Interval(-1, 5) ** Interval(-5, 3) +- Interval(low=-1.0, high=125.0) ++ Interval(low=-1.0, high=125) + >>> Interval(1, 5) ** Interval(3, 8) +- Interval(low=1.0, high=390625.0) ++ Interval(low=1, high=390625) + """ + res = [v1 ** v2 for v1, v2 in + itertools.product(range1.bounds(), range2.bounds())] +- return Interval(numpy.ceil(min(res)), numpy.floor(max(res))) ++ minres, maxres = min(res), max(res) ++ return Interval(type(minres)(numpy.ceil(minres)), ++ type(maxres)(numpy.floor(maxres))) + + def __lshift__(range1, range2): + """ diff --git a/python-pythran.changes b/python-pythran.changes index 00f33be..76ea3f9 100644 --- a/python-pythran.changes +++ b/python-pythran.changes @@ -1,7 +1,7 @@ ------------------------------------------------------------------- Sun Sep 1 13:28:40 UTC 2024 - Dirk Müller <dmueller@suse.com> -- Add patch numpy-2.1-support.patch: +- Add patch numpy-2.1-support.patch, numpy-2.1-interval.patch: * Fix test suite failure with numpy 2.1 - prepare for python 3.13 diff --git a/python-pythran.spec b/python-pythran.spec index dece249..95fac3f 100644 --- a/python-pythran.spec +++ b/python-pythran.spec @@ -58,6 +58,7 @@ Source99: python-pythran-rpmlintrc # PATCH-FIX-UPSTREAM gh#serge-sans-paille/pythran#840a0e706ec39963aec6bcd1f118bf33177c20b4 Patch0: support-gast-0.6.patch Patch1: https://github.com/serge-sans-paille/pythran/pull/2231/commits/9261d30aa9618cb2a5a698d39752263b076f2d4b.patch#/numpy-2.1-support.patch +Patch2: https://github.com/serge-sans-paille/pythran/commit/6b61e8a6b3dddab13b88e51309cbdf2f28247960.patch#/numpy-2.1-interval.patch BuildRequires: %{python_module pip} BuildRequires: %{python_module setuptools} BuildRequires: %{python_module wheel}