Update to 0.9.8post3, no longer recommend SciPy

Pythran supports some SciPy constructs,
but it doesn't mandate a Recommends.
This commit is contained in:
serge-sans-paille 2020-12-13 22:08:19 +01:00 committed by Miro Hrončok
parent 088d72059b
commit bee32227fc
4 changed files with 40 additions and 81 deletions

View File

@ -1,73 +0,0 @@
From d7b9d509458a0945d1d314b4d93fd2aaac30de96 Mon Sep 17 00:00:00 2001
From: serge-sans-paille <serge.guelton@telecom-bretagne.eu>
Date: Tue, 15 Sep 2020 22:19:32 +0200
Subject: [PATCH 1/2] Fix several testing issues on m32 architectures
- Do not overflow using 2**32
- Be explicit about array type
This is a partial fix for #1639
---
pythran/tests/test_numpy_func0.py | 4 ++--
pythran/tests/test_numpy_func2.py | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/pythran/tests/test_numpy_func0.py b/pythran/tests/test_numpy_func0.py
index 0ab6f26cc..ed6c26285 100644
--- a/pythran/tests/test_numpy_func0.py
+++ b/pythran/tests/test_numpy_func0.py
@@ -420,7 +420,7 @@ def test_tofile1(self):
def test_tofile2(self):
temp_name = tempfile.mkstemp()[1]
- x = numpy.random.randint(0,2**32,1000).astype(numpy.uint32)
+ x = numpy.random.randint(0,2**31,1000).astype(numpy.uint32)
try:
self.run_test("def np_tofile2(x,file): import numpy ; x.tofile(file); return numpy.fromfile(file)", x, temp_name, np_tofile2=[NDArray[numpy.uint32,:], str])
finally:
@@ -462,7 +462,7 @@ def test_fromfile1(self):
def test_fromfile2(self):
temp_name = tempfile.mkstemp()[1]
- x = numpy.random.randint(0,2**32,1000).astype(numpy.uint32)
+ x = numpy.random.randint(0,2**31,1000).astype(numpy.uint32)
x.tofile(temp_name)
try:
self.run_test("def np_fromfile2(file): from numpy import fromfile, uint32 ; return fromfile(file, uint32)", temp_name, np_fromfile2=[str])
diff --git a/pythran/tests/test_numpy_func2.py b/pythran/tests/test_numpy_func2.py
index e378b6501..0ff090a55 100644
--- a/pythran/tests/test_numpy_func2.py
+++ b/pythran/tests/test_numpy_func2.py
@@ -491,7 +491,7 @@ def test_asarray4(self):
self.run_test("def np_asarray4(a):\n from numpy import asarray\n return asarray(a[1:])", [(1,2),(3,4)], np_asarray4=[List[Tuple[int, int]]])
def test_asarray5(self):
- self.run_test("def np_asarray5(a):\n from numpy import asarray\n return asarray(a)", 1, np_asarray5=[int])
+ self.run_test("def np_asarray5(a):\n from numpy import asarray\n return asarray(a)", 1., np_asarray5=[float])
def test_asarray6(self):
self.run_test("def np_asarray6(a):\n from numpy import asarray\n return asarray(a, dtype=int)", 1.5, np_asarray6=[float])
From f59b69c9f08bfb69c391bf3c4ddfa10e3612ac84 Mon Sep 17 00:00:00 2001
From: serge-sans-paille <serge.guelton@telecom-bretagne.eu>
Date: Wed, 16 Sep 2020 09:47:17 +0200
Subject: [PATCH 2/2] Avoid overflow when comparing ranges
---
pythran/pythonic/builtins/range.hpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/pythran/pythonic/builtins/range.hpp b/pythran/pythonic/builtins/range.hpp
index 75ace78d1..3214ddbbe 100644
--- a/pythran/pythonic/builtins/range.hpp
+++ b/pythran/pythonic/builtins/range.hpp
@@ -64,7 +64,8 @@ namespace builtins
bool range_iterator::operator<(range_iterator const &other) const
{
- return step_ * value_ < step_ * other.value_;
+ const long sign = +1 | (step_ >> (sizeof(long) * CHAR_BIT - 1));
+ return sign * value_ < sign * other.value_;
}
long range_iterator::operator-(range_iterator const &other) const

29
4d317755a3b908cc.patch Normal file
View File

@ -0,0 +1,29 @@
From 4d317755a3b908cc2dada13619f08bae6d741944 Mon Sep 17 00:00:00 2001
From: serge-sans-paille <serge.guelton@telecom-bretagne.eu>
Date: Sun, 13 Dec 2020 22:12:16 +0100
Subject: [PATCH] Make RNG adaptor compatible with libstdc++
---
pythran/pythonic/random/shuffle.hpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pythran/pythonic/random/shuffle.hpp b/pythran/pythonic/random/shuffle.hpp
index 3d3b9eb91..19b74344f 100644
--- a/pythran/pythonic/random/shuffle.hpp
+++ b/pythran/pythonic/random/shuffle.hpp
@@ -30,13 +30,13 @@ namespace random
}
typedef unsigned result_type;
- result_type min()
+ static constexpr result_type min()
{
return 0;
}
/* -1 because of the floor() operation performed by the float->unsigned
* conversion */
- result_type max()
+ static constexpr result_type max()
{
return std::numeric_limits<result_type>::max() - 1;
}

View File

@ -1,5 +1,6 @@
Name: pythran
Version: 0.9.7
Version: 0.9.8^post3
%global uver 0.9.8post3
Release: 1%{?dist}
Summary: Ahead of Time Python compiler for numeric kernels
@ -14,10 +15,10 @@ Provides: bundled(libcxx) = 3
%py_provides python3-%{name}
URL: https://github.com/serge-sans-paille/pythran
Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz
Source0: %{url}/archive/%{uver}/%{name}-%{uver}.tar.gz
# 32bit tests fixes (merged upstream, but not part of 0.9.7)
Patch1: %{url}/pull/1640.patch
# Make RNG adaptor compatible with libstdc++
Patch1: %{url}/commit/4d317755a3b908cc.patch
# there is no actual arched content
# yet we want to test on all architectures
@ -45,8 +46,6 @@ Requires: python3-devel
Requires: boost-devel
Requires: xsimd-devel
Recommends: python%{python3_version}dist(scipy)
%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
@ -57,7 +56,7 @@ instruction units.
%prep
%autosetup -p1
%autosetup -p1 -n %{name}-%{uver}
find -name '*.hpp' -exec chmod -x {} +
sed -i '1{/#!/d}' pythran/run.py
@ -108,6 +107,10 @@ rm -rf docs/_build/html/.{doctrees,buildinfo}
%changelog
* Sun Dec 13 2020 sguelton@redhat.com - 0.9.8^post3-1
- Update to 0.9.8post3
- No longer recommend SciPy
* Wed Sep 23 2020 Miro Hrončok <mhroncok@redhat.com> - 0.9.7-1
- Update to 0.9.7
- Rebuilt for Python 3.9

View File

@ -1 +1 @@
SHA512 (pythran-0.9.7.tar.gz) = 25a0afefcdf53b1c72c37bda48133ec6adfc29473b966992ea781bebac7e8b75c4ef05f045467e329caa6bdd3249a924a5b48eddb5b8b4202ce292fd5f15580f
SHA512 (pythran-0.9.8post3.tar.gz) = 2c81745157ffc61018c234f9cae7d1b78bb1f55ae08594fbcf05b3a1025c14ac734457da6724f5778e217ac19913274fdf9e7b77a40f81f3bd28e4ef12257778