Update to 0.12.0

This commit is contained in:
Miro Hrončok 2022-09-28 11:49:05 +02:00
parent f8da679b00
commit bcbb48375b
8 changed files with 7 additions and 278 deletions

View File

@ -1,24 +0,0 @@
From 343cb724d857fe8adcef071ab088df2c02ba0d4c Mon Sep 17 00:00:00 2001
From: Jonathan Wakely <jwakely@redhat.com>
Date: Mon, 14 Mar 2022 10:11:00 +0000
Subject: [PATCH] Add default constructor to string_iterator
A type must be default constructible to meet the forward iterator requirements.
GCC 12 won't compile `std::reverse_iterator<string_iterator>` without
this change.
---
pythran/pythonic/include/types/str.hpp | 1 +
1 file changed, 1 insertion(+)
diff --git a/pythran/pythonic/include/types/str.hpp b/pythran/pythonic/include/types/str.hpp
index 329de1c1d..a0df45905 100644
--- a/pythran/pythonic/include/types/str.hpp
+++ b/pythran/pythonic/include/types/str.hpp
@@ -231,6 +231,7 @@ namespace types
struct string_iterator : std::iterator<std::random_access_iterator_tag, str,
std::ptrdiff_t, str *, str> {
std::string::const_iterator curr;
+ string_iterator() = default;
string_iterator(std::string::const_iterator iter) : curr(iter)
{
}

View File

@ -1,121 +0,0 @@
From e06d2c95bf88f84f9e570eeece5c3408fd8f24fe Mon Sep 17 00:00:00 2001
From: serge-sans-paille <serge.guelton@telecom-bretagne.eu>
Date: Mon, 14 Mar 2022 16:10:12 +0100
Subject: [PATCH] Move mult operator for str to the appropriate ns
---
pythran/pythonic/include/types/str.hpp | 11 +++--
pythran/pythonic/types/str.hpp | 64 +++++++++++++-------------
2 files changed, 38 insertions(+), 37 deletions(-)
diff --git a/pythran/pythonic/include/types/str.hpp b/pythran/pythonic/include/types/str.hpp
index 329de1c1d..5aa526692 100644
--- a/pythran/pythonic/include/types/str.hpp
+++ b/pythran/pythonic/include/types/str.hpp
@@ -318,6 +318,12 @@ namespace types
std::ostream &operator<<(std::ostream &os, chr const &s);
std::ostream &operator<<(std::ostream &os, str const &s);
+
+ str operator*(str const &s, long n);
+ str operator*(long t, str const &s);
+ str operator*(chr const &s, long n);
+ str operator*(long t, chr const &s);
+
}
namespace operator_
@@ -356,11 +362,6 @@ struct assignable<char const[N]> {
};
PYTHONIC_NS_END
-pythonic::types::str operator*(pythonic::types::str const &s, long n);
-pythonic::types::str operator*(long t, pythonic::types::str const &s);
-pythonic::types::str operator*(pythonic::types::chr const &s, long n);
-pythonic::types::str operator*(long t, pythonic::types::chr const &s);
-
namespace std
{
template <>
diff --git a/pythran/pythonic/types/str.hpp b/pythran/pythonic/types/str.hpp
index 6e9bc241f..ee540a73b 100644
--- a/pythran/pythonic/types/str.hpp
+++ b/pythran/pythonic/types/str.hpp
@@ -655,6 +655,38 @@ namespace types
{
return os << s.c_str();
}
+
+ str operator*(str const &s, long n)
+ {
+ if (n <= 0)
+ return str();
+ str other;
+ other.resize(s.size() * n);
+ auto where = other.chars().begin();
+ for (long i = 0; i < n; i++, where += s.size())
+ std::copy(s.chars().begin(), s.chars().end(), where);
+ return other;
+ }
+
+ str operator*(long t, str const &s)
+ {
+ return s * t;
+ }
+
+ str operator*(chr const &s, long n)
+ {
+ if (n <= 0)
+ return str();
+ str other;
+ other.resize(n);
+ std::fill(other.chars().begin(), other.chars().end(), s.c);
+ return other;
+ }
+
+ str operator*(long t, chr const &c)
+ {
+ return c * t;
+ }
}
namespace operator_
@@ -686,38 +718,6 @@ namespace operator_
}
PYTHONIC_NS_END
-pythonic::types::str operator*(pythonic::types::str const &s, long n)
-{
- if (n <= 0)
- return pythonic::types::str();
- pythonic::types::str other;
- other.resize(s.size() * n);
- auto where = other.chars().begin();
- for (long i = 0; i < n; i++, where += s.size())
- std::copy(s.chars().begin(), s.chars().end(), where);
- return other;
-}
-
-pythonic::types::str operator*(long t, pythonic::types::str const &s)
-{
- return s * t;
-}
-
-pythonic::types::str operator*(pythonic::types::chr const &s, long n)
-{
- if (n <= 0)
- return pythonic::types::str();
- pythonic::types::str other;
- other.resize(n);
- std::fill(other.chars().begin(), other.chars().end(), s.c);
- return other;
-}
-
-pythonic::types::str operator*(long t, pythonic::types::chr const &c)
-{
- return c * t;
-}
-
namespace std
{

View File

@ -1,24 +0,0 @@
From 7c623444ce7fa3679038b173236a716d100bb92b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
Date: Mon, 6 Jun 2022 13:25:14 +0200
Subject: [PATCH] Don't use removed sysconfig.get_config_vars()["SO"] in a
doctest
This was removed from Python 3.11+, see https://github.com/python/cpython/issues/91670
---
pythran/toolchain.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pythran/toolchain.py b/pythran/toolchain.py
index 5a9523903..bb0404466 100644
--- a/pythran/toolchain.py
+++ b/pythran/toolchain.py
@@ -451,7 +451,7 @@ def compile_pythranfile(file_path, output_file=None, module_name=None,
Specify the output file:
>>> import sysconfig
- >>> ext = sysconfig.get_config_vars()["SO"]
+ >>> ext = sysconfig.get_config_vars()["EXT_SUFFIX"]
>>> so_path = compile_pythranfile('pythran_test.py', output_file='foo'+ext)
"""
if not output_file:

View File

@ -1,39 +0,0 @@
From 821238d492a208c148f802dfd18bf1089dea9f22 Mon Sep 17 00:00:00 2001
From: serge-sans-paille <serge.guelton@telecom-bretagne.eu>
Date: Wed, 8 Jun 2022 18:14:17 +0200
Subject: [PATCH] Since python 3.11, random.shuffle takes a single argument
see deprecation notice in https://docs.python.org/3/library/random.html#random.shuffle
Fix #1995
---
pythran/tests/test_random.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/pythran/tests/test_random.py b/pythran/tests/test_random.py
index 209ca5b6f1..7c60593727 100644
--- a/pythran/tests/test_random.py
+++ b/pythran/tests/test_random.py
@@ -1,5 +1,7 @@
""" Check the random module behavior. """
from pythran.tests import TestEnv
+from unittest import skipIf
+import sys
@TestEnv.module
@@ -109,6 +111,7 @@ def shuffle1(n):
return r != list(range(n)) and sorted(r) == list(range(n))""",
10, shuffle1=[int])
+ @skipIf(sys.version_info >= (3, 11), "no shuffler option since 3.11")
def test_shuffle2(self):
""" Check shuffling with custom function. """
self.run_test("""
@@ -119,6 +122,7 @@ def shuffle2(n):
return r != list(range(n)) and sorted(r) == list(range(n))""",
10 ** 4, shuffle2=[int])
+ @skipIf(sys.version_info >= (3, 11), "no shuffler option since 3.11")
def test_shuffle3(self):
""" Check shuffling with random function. """
self.run_test("""

View File

@ -1,32 +0,0 @@
From 8202edbb455be8afdfeb6f9e092c5d36b7aa5c63 Mon Sep 17 00:00:00 2001
From: serge-sans-paille <serge.guelton@telecom-bretagne.eu>
Date: Sat, 1 Jan 2022 13:17:07 +0100
Subject: [PATCH] Rework numpy logical accumulate to match numpy update
---
pythran/tests/test_numpy_ufunc_binary.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/pythran/tests/test_numpy_ufunc_binary.py b/pythran/tests/test_numpy_ufunc_binary.py
index 139129ada..3485c0800 100644
--- a/pythran/tests/test_numpy_ufunc_binary.py
+++ b/pythran/tests/test_numpy_ufunc_binary.py
@@ -31,6 +31,9 @@ class TestNumpyUFuncBinary(TestEnv):
reduced_ufunc = {'add', 'minimum', 'maximum', 'multiply', 'bitwise_or',
'bitwise_and', 'bitwise_xor'}
+cmp_ufunc = ('equal', 'greater_equal', 'less_equal', 'not_equal', 'greater',
+ 'less')
+
for ns, f in binary_ufunc:
if 'bitwise_' in f or 'ldexp' in f or '_shift' in f :
setattr(TestNumpyUFuncBinary, 'test_' + f, eval("lambda self: self.run_test('def np_{0}(a): from {1} import {0} ; return {0}(a,a)', numpy.ones(10, numpy.int32), np_{0}=[NDArray[numpy.int32,:]])".format(f, ns)))
@@ -78,7 +81,7 @@ class TestNumpyUFuncBinary(TestEnv):
pass
## Tests for accumulation
- if 'scipy' not in ns:
+ if 'scipy' not in ns and f not in cmp_ufunc:
setattr(TestNumpyUFuncBinary, 'test_accumulate_' + f, eval("lambda self: self.run_test('def np_{0}_accumulate(a): from {1} import {0} ; return {0}.accumulate(a)', numpy.ones(10), np_{0}_accumulate=[NDArray[float,:]])".format(f, ns)))
setattr(TestNumpyUFuncBinary, 'test_accumulate_' + f + '_matrix', eval("lambda self: self.run_test('def np_{0}_matrix_accumulate(a): from {1} import {0} ; return {0}.accumulate(a)', numpy.ones((2,5)) - 0.2 , np_{0}_matrix_accumulate=[NDArray[float, :, :]])".format(f, ns)))
## Tests for reduction

View File

@ -1,25 +0,0 @@
From a0571440f5ba08ab3bbfb8aa01831904dfd96815 Mon Sep 17 00:00:00 2001
From: serge-sans-paille <serge.guelton@telecom-bretagne.eu>
Date: Sat, 1 Jan 2022 10:02:43 +0100
Subject: [PATCH] Numpy no longer supports floordiv on complex for python 3.10
---
pythran/tests/test_complex.py | 5 -----
1 file changed, 5 deletions(-)
diff --git a/pythran/tests/test_complex.py b/pythran/tests/test_complex.py
index f835ff3760..22a60afc29 100644
--- a/pythran/tests/test_complex.py
+++ b/pythran/tests/test_complex.py
@@ -60,11 +60,6 @@ def test_complex_array_abs(self):
np.array([[3 + 2j]]),
test_complex_array_abs=[NDArray[complex, :, :]])
- def test_complex_floordiv(self):
- self.run_test('def complex_floordiv(x): import numpy as np; return np.floor_divide(x, 2 + 2j)',
- 3.5 - 3.5j,
- complex_floordiv=[complex])
-
def test_complex_array_sqr(self):
self.run_test('def test_complex_array_sqr(a): return a ** 2',
np.array([[3 + 2j]]),

View File

@ -1,6 +1,6 @@
Name: pythran
Version: 0.11.0
Release: 6%{?dist}
Version: 0.12.0
Release: 1%{?dist}
Summary: Ahead of Time Python compiler for numeric kernels
# pythran is BSD
@ -50,16 +50,6 @@ Requires: python3-devel
Requires: boost-devel
Requires: xsimd-devel >= 8
# Upstream fixes for GCC 12
Patch: https://github.com/serge-sans-paille/pythran/pull/1976.patch
Patch: https://github.com/serge-sans-paille/pythran/pull/1979.patch
Patch: https://github.com/serge-sans-paille/pythran/commit/a0571440f5ba08ab3bbfb8aa01831904dfd96815.patch
Patch: https://github.com/serge-sans-paille/pythran/commit/8202edbb455be8afdfeb6f9e092c5d36b7aa5c63.patch
# Upstream fixes for Python 3.11
Patch: https://github.com/serge-sans-paille/pythran/pull/1996.patch
Patch: https://github.com/serge-sans-paille/pythran/pull/1997.patch
%description
Pythran is an ahead of time compiler for a subset of the Python language, with
a focus on scientific computing. It takes a Python module annotated with a few
@ -144,6 +134,10 @@ k="$k and not test_setup_bdist_install3"
%changelog
* Wed Sep 28 2022 Miro Hrončok <mhroncok@redhat.com> - 0.12.0-1
- Update to 0.12.0
- Fixes: rhbz#2130464
* Fri Jul 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.11.0-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild

View File

@ -1 +1 @@
SHA512 (pythran-0.11.0.tar.gz) = bd703148f26a0511f5a21e691e62f4e9b7bf5a92548f8ac837b2d24135917b71b052941180c9801f29c457018eb57e5f5107a509d6815d8dd8ddab1b8626b1a1
SHA512 (pythran-0.12.0.tar.gz) = 8f698cb2efc8e53005a6a18b81b9119796d56e638c4634d3a9268bc8d4ac340c7ff1a26212f17210ad7200eb8a3e0f9dd20702d9d9c51f24a76dadc7d0877693