forked from pool/python-pythran
Compare commits
11 Commits
Author | SHA256 | Date | |
---|---|---|---|
97e0411112 | |||
9dab90effc | |||
6cfc8c93ef | |||
fc79112197 | |||
10c7a335e7 | |||
f8e8e5f5a6 | |||
844cea57bf | |||
0e67cb4c62 | |||
59750e7e5a | |||
4632f56ec3 | |||
60eb19dd17 |
129
GCC15_fix_Add-missing-operators-to-nditerator.patch
Normal file
129
GCC15_fix_Add-missing-operators-to-nditerator.patch
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
From 14b78f0db9cbd253414b751d14644843354e7557 Mon Sep 17 00:00:00 2001
|
||||||
|
From: cielavenir <cielartisan@gmail.com>
|
||||||
|
Date: Fri, 6 Jun 2025 16:21:52 +0900
|
||||||
|
Subject: [PATCH 1/5] Add missing operators to nditerator
|
||||||
|
|
||||||
|
---
|
||||||
|
pythran/pythonic/include/types/nditerator.hpp | 9 +++
|
||||||
|
pythran/pythonic/types/nditerator.hpp | 57 +++++++++++++++++++
|
||||||
|
2 files changed, 66 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/pythran/pythonic/include/types/nditerator.hpp b/pythran/pythonic/include/types/nditerator.hpp
|
||||||
|
index 0d1f8281a..934e5cc0a 100644
|
||||||
|
--- a/pythran/pythonic/include/types/nditerator.hpp
|
||||||
|
+++ b/pythran/pythonic/include/types/nditerator.hpp
|
||||||
|
@@ -66,6 +66,9 @@ namespace types
|
||||||
|
bool operator!=(nditerator<E> const &other) const;
|
||||||
|
bool operator==(nditerator<E> const &other) const;
|
||||||
|
bool operator<(nditerator<E> const &other) const;
|
||||||
|
+ bool operator>(nditerator<E> const &other) const;
|
||||||
|
+ bool operator<=(nditerator<E> const &other) const;
|
||||||
|
+ bool operator>=(nditerator<E> const &other) const;
|
||||||
|
nditerator &operator=(nditerator const &other);
|
||||||
|
};
|
||||||
|
|
||||||
|
@@ -92,6 +95,9 @@ namespace types
|
||||||
|
bool operator!=(const_nditerator<E> const &other) const;
|
||||||
|
bool operator==(const_nditerator<E> const &other) const;
|
||||||
|
bool operator<(const_nditerator<E> const &other) const;
|
||||||
|
+ bool operator>(const_nditerator<E> const &other) const;
|
||||||
|
+ bool operator<=(const_nditerator<E> const &other) const;
|
||||||
|
+ bool operator>=(const_nditerator<E> const &other) const;
|
||||||
|
const_nditerator &operator=(const_nditerator const &other);
|
||||||
|
};
|
||||||
|
#ifdef USE_XSIMD
|
||||||
|
@@ -115,6 +121,9 @@ namespace types
|
||||||
|
bool operator!=(const_simd_nditerator const &other) const;
|
||||||
|
bool operator==(const_simd_nditerator const &other) const;
|
||||||
|
bool operator<(const_simd_nditerator const &other) const;
|
||||||
|
+ bool operator>(const_simd_nditerator const &other) const;
|
||||||
|
+ bool operator<=(const_simd_nditerator const &other) const;
|
||||||
|
+ bool operator>=(const_simd_nditerator const &other) const;
|
||||||
|
const_simd_nditerator &operator=(const_simd_nditerator const &other);
|
||||||
|
void store(xsimd::batch<typename E::dtype> const &);
|
||||||
|
};
|
||||||
|
diff --git a/pythran/pythonic/types/nditerator.hpp b/pythran/pythonic/types/nditerator.hpp
|
||||||
|
index 2cb2b9047..ef2b7c4a8 100644
|
||||||
|
--- a/pythran/pythonic/types/nditerator.hpp
|
||||||
|
+++ b/pythran/pythonic/types/nditerator.hpp
|
||||||
|
@@ -97,6 +97,24 @@ namespace types
|
||||||
|
return index < other.index;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ template <class E>
|
||||||
|
+ bool nditerator<E>::operator>(nditerator<E> const &other) const
|
||||||
|
+ {
|
||||||
|
+ return index > other.index;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ template <class E>
|
||||||
|
+ bool nditerator<E>::operator<=(nditerator<E> const &other) const
|
||||||
|
+ {
|
||||||
|
+ return !(index > other.index);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ template <class E>
|
||||||
|
+ bool nditerator<E>::operator>=(nditerator<E> const &other) const
|
||||||
|
+ {
|
||||||
|
+ return !(index < other.index);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
template <class E>
|
||||||
|
nditerator<E> &nditerator<E>::operator=(nditerator<E> const &other)
|
||||||
|
{
|
||||||
|
@@ -188,6 +206,24 @@ namespace types
|
||||||
|
return index < other.index;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ template <class E>
|
||||||
|
+ bool const_nditerator<E>::operator>(const_nditerator<E> const &other) const
|
||||||
|
+ {
|
||||||
|
+ return index > other.index;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ template <class E>
|
||||||
|
+ bool const_nditerator<E>::operator<=(const_nditerator<E> const &other) const
|
||||||
|
+ {
|
||||||
|
+ return !(index > other.index);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ template <class E>
|
||||||
|
+ bool const_nditerator<E>::operator>=(const_nditerator<E> const &other) const
|
||||||
|
+ {
|
||||||
|
+ return !(index < other.index);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
template <class E>
|
||||||
|
const_nditerator<E> &
|
||||||
|
const_nditerator<E>::operator=(const_nditerator const &other)
|
||||||
|
@@ -271,6 +307,27 @@ namespace types
|
||||||
|
return data < other.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ template <class E>
|
||||||
|
+ bool const_simd_nditerator<E>::operator>(
|
||||||
|
+ const_simd_nditerator<E> const &other) const
|
||||||
|
+ {
|
||||||
|
+ return data > other.data;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ template <class E>
|
||||||
|
+ bool const_simd_nditerator<E>::operator<=(
|
||||||
|
+ const_simd_nditerator<E> const &other) const
|
||||||
|
+ {
|
||||||
|
+ return !(data > other.data);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ template <class E>
|
||||||
|
+ bool const_simd_nditerator<E>::operator>=(
|
||||||
|
+ const_simd_nditerator<E> const &other) const
|
||||||
|
+ {
|
||||||
|
+ return !(data < other.data);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
template <class E>
|
||||||
|
const_simd_nditerator<E> &
|
||||||
|
const_simd_nditerator<E>::operator=(const_simd_nditerator const &other)
|
||||||
|
--
|
||||||
|
2.49.0
|
||||||
|
|
322
GCC15_pythran-PR2325-missing-operators.patch
Normal file
322
GCC15_pythran-PR2325-missing-operators.patch
Normal file
@ -0,0 +1,322 @@
|
|||||||
|
From 623fa5031df7ec5c3dfe6789bf608cf11ac95c36 Mon Sep 17 00:00:00 2001
|
||||||
|
From: serge-sans-paille <serge.guelton@telecom-bretagne.eu>
|
||||||
|
Date: Wed, 11 Jun 2025 23:49:40 +0200
|
||||||
|
Subject: [PATCH] Add missing iterator comparison operators
|
||||||
|
|
||||||
|
Fix #2324
|
||||||
|
---
|
||||||
|
pythran/pythonic/builtins/map.hpp | 37 +++++++++++++++----
|
||||||
|
pythran/pythonic/builtins/range.hpp | 6 +++
|
||||||
|
pythran/pythonic/include/builtins/map.hpp | 16 +++++---
|
||||||
|
pythran/pythonic/include/builtins/range.hpp | 1 +
|
||||||
|
.../pythonic/include/numpy/ndenumerate.hpp | 4 ++
|
||||||
|
pythran/pythonic/include/numpy/ndindex.hpp | 4 ++
|
||||||
|
pythran/pythonic/include/types/array.hpp | 8 +++-
|
||||||
|
pythran/pythonic/include/types/numpy_expr.hpp | 31 +++++++++-------
|
||||||
|
pythran/pythonic/include/types/str.hpp | 13 +++++--
|
||||||
|
9 files changed, 88 insertions(+), 32 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/pythran/pythonic/builtins/map.hpp b/pythran/pythonic/builtins/map.hpp
|
||||||
|
index ac6eb0354..e81dd2c46 100644
|
||||||
|
--- a/pythran/pythonic/builtins/map.hpp
|
||||||
|
+++ b/pythran/pythonic/builtins/map.hpp
|
||||||
|
@@ -143,11 +143,35 @@ namespace builtins
|
||||||
|
return !(*this == other);
|
||||||
|
}
|
||||||
|
|
||||||
|
+ template <typename Operator, typename... Iters>
|
||||||
|
+ template <size_t N>
|
||||||
|
+ bool map_iterator<Operator, Iters...>::lt(
|
||||||
|
+ map_iterator<Operator, Iters...> const &other, utils::int_<N>) const
|
||||||
|
+ {
|
||||||
|
+ return std::get<N>(it) < std::get<N>(other.it) ||
|
||||||
|
+ ((std::get<N>(it) == std::get<N>(other.it)) &&
|
||||||
|
+ lt(other, utils::int_<N - 1>()));
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ template <typename Operator, typename... Iters>
|
||||||
|
+ bool map_iterator<Operator, Iters...>::lt(
|
||||||
|
+ map_iterator<Operator, Iters...> const &other, utils::int_<0>) const
|
||||||
|
+ {
|
||||||
|
+ return std::get<0>(it) < std::get<0>(other.it);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
template <typename Operator, typename... Iters>
|
||||||
|
bool map_iterator<Operator, Iters...>::operator<(
|
||||||
|
map_iterator<Operator, Iters...> const &other) const
|
||||||
|
{
|
||||||
|
- return !(*this == other);
|
||||||
|
+ return lt(other, utils::int_<sizeof...(Iters) - 1>());
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ template <typename Operator, typename... Iters>
|
||||||
|
+ bool map_iterator<Operator, Iters...>::operator<=(
|
||||||
|
+ map_iterator<Operator, Iters...> const &other) const
|
||||||
|
+ {
|
||||||
|
+ return (*this == other) || (*this < other);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename Operator, typename... Iters>
|
||||||
|
@@ -208,12 +232,11 @@ namespace builtins
|
||||||
|
} // namespace details
|
||||||
|
|
||||||
|
template <typename Operator, typename... Iter>
|
||||||
|
- auto map(Operator &&_op, Iter &&...iters)
|
||||||
|
- -> details::map<
|
||||||
|
- typename std::remove_cv<
|
||||||
|
- typename std::remove_reference<Operator>::type>::type,
|
||||||
|
- typename types::iterator<typename std::remove_cv<
|
||||||
|
- typename std::remove_reference<Iter>::type>::type>::type...>
|
||||||
|
+ auto map(Operator &&_op, Iter &&...iters) -> details::map<
|
||||||
|
+ typename std::remove_cv<
|
||||||
|
+ typename std::remove_reference<Operator>::type>::type,
|
||||||
|
+ typename types::iterator<typename std::remove_cv<
|
||||||
|
+ typename std::remove_reference<Iter>::type>::type>::type...>
|
||||||
|
{
|
||||||
|
return {std::forward<Operator>(_op), std::forward<Iter>(iters)...};
|
||||||
|
}
|
||||||
|
diff --git a/pythran/pythonic/builtins/range.hpp b/pythran/pythonic/builtins/range.hpp
|
||||||
|
index 2c3f3971d..bff58960e 100644
|
||||||
|
--- a/pythran/pythonic/builtins/range.hpp
|
||||||
|
+++ b/pythran/pythonic/builtins/range.hpp
|
||||||
|
@@ -89,6 +89,12 @@ namespace builtins
|
||||||
|
return sign * value_ < sign * other.value_;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ inline bool range_iterator::operator<=(range_iterator const &other) const
|
||||||
|
+ {
|
||||||
|
+ const long sign = +1 | (step_ >> (sizeof(long) * CHAR_BIT - 1));
|
||||||
|
+ return sign * value_ <= sign * other.value_;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
inline long range_iterator::operator-(range_iterator const &other) const
|
||||||
|
{
|
||||||
|
return (value_ - other.value_) / step_;
|
||||||
|
diff --git a/pythran/pythonic/include/builtins/map.hpp b/pythran/pythonic/include/builtins/map.hpp
|
||||||
|
index 788106712..8f358bd50 100644
|
||||||
|
--- a/pythran/pythonic/include/builtins/map.hpp
|
||||||
|
+++ b/pythran/pythonic/include/builtins/map.hpp
|
||||||
|
@@ -56,6 +56,7 @@ namespace builtins
|
||||||
|
bool operator==(map_iterator const &other) const;
|
||||||
|
bool operator!=(map_iterator const &other) const;
|
||||||
|
bool operator<(map_iterator const &other) const;
|
||||||
|
+ bool operator<=(map_iterator const &other) const;
|
||||||
|
long operator-(map_iterator const &other) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
@@ -69,6 +70,10 @@ namespace builtins
|
||||||
|
bool equal(map_iterator const &other, utils::int_<N>) const;
|
||||||
|
bool equal(map_iterator const &other, utils::int_<0>) const;
|
||||||
|
|
||||||
|
+ template <size_t N>
|
||||||
|
+ bool lt(map_iterator const &other, utils::int_<N>) const;
|
||||||
|
+ bool lt(map_iterator const &other, utils::int_<0>) const;
|
||||||
|
+
|
||||||
|
template <size_t I>
|
||||||
|
void advance(long i, utils::int_<I>);
|
||||||
|
void advance(long i, utils::int_<0>);
|
||||||
|
@@ -107,12 +112,11 @@ namespace builtins
|
||||||
|
} // namespace details
|
||||||
|
|
||||||
|
template <typename Operator, typename... Iter>
|
||||||
|
- auto map(Operator &&_op, Iter &&...iters)
|
||||||
|
- -> details::map<
|
||||||
|
- typename std::remove_cv<
|
||||||
|
- typename std::remove_reference<Operator>::type>::type,
|
||||||
|
- typename types::iterator<typename std::remove_cv<
|
||||||
|
- typename std::remove_reference<Iter>::type>::type>::type...>;
|
||||||
|
+ auto map(Operator &&_op, Iter &&...iters) -> details::map<
|
||||||
|
+ typename std::remove_cv<
|
||||||
|
+ typename std::remove_reference<Operator>::type>::type,
|
||||||
|
+ typename types::iterator<typename std::remove_cv<
|
||||||
|
+ typename std::remove_reference<Iter>::type>::type>::type...>;
|
||||||
|
|
||||||
|
DEFINE_FUNCTOR(pythonic::builtins, map);
|
||||||
|
} // namespace builtins
|
||||||
|
diff --git a/pythran/pythonic/include/builtins/range.hpp b/pythran/pythonic/include/builtins/range.hpp
|
||||||
|
index 7c40b6dcd..82e1c18ec 100644
|
||||||
|
--- a/pythran/pythonic/include/builtins/range.hpp
|
||||||
|
+++ b/pythran/pythonic/include/builtins/range.hpp
|
||||||
|
@@ -28,6 +28,7 @@ namespace builtins
|
||||||
|
bool operator!=(range_iterator const &other) const;
|
||||||
|
bool operator==(range_iterator const &other) const;
|
||||||
|
bool operator<(range_iterator const &other) const;
|
||||||
|
+ bool operator<=(range_iterator const &other) const;
|
||||||
|
long operator-(range_iterator const &other) const;
|
||||||
|
};
|
||||||
|
} // namespace
|
||||||
|
diff --git a/pythran/pythonic/include/numpy/ndenumerate.hpp b/pythran/pythonic/include/numpy/ndenumerate.hpp
|
||||||
|
index 18d78f2ef..ad8bbca22 100644
|
||||||
|
--- a/pythran/pythonic/include/numpy/ndenumerate.hpp
|
||||||
|
+++ b/pythran/pythonic/include/numpy/ndenumerate.hpp
|
||||||
|
@@ -25,6 +25,10 @@ namespace numpy
|
||||||
|
ndenumerate_iterator &operator++();
|
||||||
|
ndenumerate_iterator &operator+=(long n);
|
||||||
|
bool operator!=(ndenumerate_iterator const &other) const;
|
||||||
|
+ bool operator==(ndenumerate_iterator const &other) const
|
||||||
|
+ {
|
||||||
|
+ return !(*this != other);
|
||||||
|
+ }
|
||||||
|
bool operator<(ndenumerate_iterator const &other) const;
|
||||||
|
long operator-(ndenumerate_iterator const &other) const;
|
||||||
|
};
|
||||||
|
diff --git a/pythran/pythonic/include/numpy/ndindex.hpp b/pythran/pythonic/include/numpy/ndindex.hpp
|
||||||
|
index 387665cdb..8361f4ffd 100644
|
||||||
|
--- a/pythran/pythonic/include/numpy/ndindex.hpp
|
||||||
|
+++ b/pythran/pythonic/include/numpy/ndindex.hpp
|
||||||
|
@@ -25,6 +25,10 @@ namespace numpy
|
||||||
|
ndindex_iterator &operator++();
|
||||||
|
ndindex_iterator &operator+=(long n);
|
||||||
|
bool operator!=(ndindex_iterator const &other) const;
|
||||||
|
+ bool operator==(ndindex_iterator const &other) const
|
||||||
|
+ {
|
||||||
|
+ return !(*this != other);
|
||||||
|
+ }
|
||||||
|
bool operator<(ndindex_iterator const &other) const;
|
||||||
|
long operator-(ndindex_iterator const &other) const;
|
||||||
|
};
|
||||||
|
diff --git a/pythran/pythonic/include/types/array.hpp b/pythran/pythonic/include/types/array.hpp
|
||||||
|
index d4e6c1e06..b9bbe722b 100644
|
||||||
|
--- a/pythran/pythonic/include/types/array.hpp
|
||||||
|
+++ b/pythran/pythonic/include/types/array.hpp
|
||||||
|
@@ -129,6 +129,10 @@ namespace types
|
||||||
|
{
|
||||||
|
return index < other.index;
|
||||||
|
}
|
||||||
|
+ bool operator<=(array_iterator const &other) const
|
||||||
|
+ {
|
||||||
|
+ return index <= other.index;
|
||||||
|
+ }
|
||||||
|
array_iterator &operator=(array_iterator const &other)
|
||||||
|
{
|
||||||
|
index = other.index;
|
||||||
|
@@ -181,8 +185,8 @@ namespace types
|
||||||
|
|
||||||
|
using shape_t = types::array_tuple<long, value>;
|
||||||
|
template <size_t I>
|
||||||
|
- auto shape() const -> decltype(details::extract_shape(*this,
|
||||||
|
- utils::int_<I>{}))
|
||||||
|
+ auto shape() const
|
||||||
|
+ -> decltype(details::extract_shape(*this, utils::int_<I>{}))
|
||||||
|
{
|
||||||
|
return details::extract_shape(*this, utils::int_<I>{});
|
||||||
|
}
|
||||||
|
diff --git a/pythran/pythonic/include/types/numpy_expr.hpp b/pythran/pythonic/include/types/numpy_expr.hpp
|
||||||
|
index 0d13801a6..a6fc24d67 100644
|
||||||
|
--- a/pythran/pythonic/include/types/numpy_expr.hpp
|
||||||
|
+++ b/pythran/pythonic/include/types/numpy_expr.hpp
|
||||||
|
@@ -116,7 +116,7 @@ namespace types
|
||||||
|
}
|
||||||
|
|
||||||
|
auto operator*() const -> decltype(this->_dereference(
|
||||||
|
- utils::make_index_sequence<sizeof...(Iters)>{}))
|
||||||
|
+ utils::make_index_sequence<sizeof...(Iters)>{}))
|
||||||
|
{
|
||||||
|
return _dereference(utils::make_index_sequence<sizeof...(Iters)>{});
|
||||||
|
}
|
||||||
|
@@ -240,6 +240,11 @@ namespace types
|
||||||
|
{
|
||||||
|
return _lt(other, utils::int_<sizeof...(Iters)>{});
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ bool operator<=(numpy_expr_iterator const &other) const
|
||||||
|
+ {
|
||||||
|
+ return *this < other || *this == other;
|
||||||
|
+ }
|
||||||
|
};
|
||||||
|
#ifdef USE_XSIMD
|
||||||
|
template <class E, class Op, class Steps, class SIters, class... Iters>
|
||||||
|
@@ -279,7 +284,7 @@ namespace types
|
||||||
|
}
|
||||||
|
|
||||||
|
auto operator*() const -> decltype(this->_dereference(
|
||||||
|
- utils::make_index_sequence<sizeof...(Iters)>{}))
|
||||||
|
+ utils::make_index_sequence<sizeof...(Iters)>{}))
|
||||||
|
{
|
||||||
|
return _dereference(utils::make_index_sequence<sizeof...(Iters)>{});
|
||||||
|
}
|
||||||
|
@@ -439,7 +444,7 @@ namespace types
|
||||||
|
}
|
||||||
|
|
||||||
|
auto operator*() const -> decltype(this->_dereference(
|
||||||
|
- utils::make_index_sequence<sizeof...(Iters)>{}))
|
||||||
|
+ utils::make_index_sequence<sizeof...(Iters)>{}))
|
||||||
|
{
|
||||||
|
return _dereference(utils::make_index_sequence<sizeof...(Iters)>{});
|
||||||
|
}
|
||||||
|
@@ -583,9 +588,9 @@ namespace types
|
||||||
|
}
|
||||||
|
|
||||||
|
template <size_t... J, class Arg, class Shp, class... S>
|
||||||
|
- auto
|
||||||
|
- make_subslice(utils::index_sequence<J...>, Arg const &arg, Shp const &shp,
|
||||||
|
- std::tuple<S...> const &ss) -> decltype(arg(std::get<J>(ss)...))
|
||||||
|
+ auto make_subslice(utils::index_sequence<J...>, Arg const &arg,
|
||||||
|
+ Shp const &shp, std::tuple<S...> const &ss)
|
||||||
|
+ -> decltype(arg(std::get<J>(ss)...))
|
||||||
|
{
|
||||||
|
// we need to adapt_slice to take broadcasting into account
|
||||||
|
return arg(adapt_slice(
|
||||||
|
@@ -708,15 +713,14 @@ namespace types
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class... Indices>
|
||||||
|
- auto map_fast(Indices... indices) const
|
||||||
|
- -> decltype(this->_map_fast(
|
||||||
|
- array_tuple<long, sizeof...(Indices)>{{indices...}},
|
||||||
|
- utils::make_index_sequence<sizeof...(Args)>{}));
|
||||||
|
+ auto map_fast(Indices... indices) const -> decltype(this->_map_fast(
|
||||||
|
+ array_tuple<long, sizeof...(Indices)>{{indices...}},
|
||||||
|
+ utils::make_index_sequence<sizeof...(Args)>{}));
|
||||||
|
|
||||||
|
public:
|
||||||
|
template <size_t I>
|
||||||
|
auto shape() const -> decltype(details::init_shape_element<I>(
|
||||||
|
- args, valid_indices<value, std::tuple<Args...>>{}))
|
||||||
|
+ args, valid_indices<value, std::tuple<Args...>>{}))
|
||||||
|
{
|
||||||
|
return details::init_shape_element<I>(
|
||||||
|
args, valid_indices<value, std::tuple<Args...>>{});
|
||||||
|
@@ -819,9 +823,8 @@ namespace types
|
||||||
|
return Op{}(std::get<I>(args)[s]...);
|
||||||
|
}
|
||||||
|
template <class S>
|
||||||
|
- auto operator[](S s) const
|
||||||
|
- -> decltype((*this)._index(
|
||||||
|
- (s.lower, s), utils::make_index_sequence<sizeof...(Args)>{}))
|
||||||
|
+ auto operator[](S s) const -> decltype((*this)._index(
|
||||||
|
+ (s.lower, s), utils::make_index_sequence<sizeof...(Args)>{}))
|
||||||
|
{
|
||||||
|
return _index(s, utils::make_index_sequence<sizeof...(Args)>{});
|
||||||
|
}
|
||||||
|
diff --git a/pythran/pythonic/include/types/str.hpp b/pythran/pythonic/include/types/str.hpp
|
||||||
|
index ca373c734..73a39f35a 100644
|
||||||
|
--- a/pythran/pythonic/include/types/str.hpp
|
||||||
|
+++ b/pythran/pythonic/include/types/str.hpp
|
||||||
|
@@ -275,6 +275,14 @@ namespace types
|
||||||
|
{
|
||||||
|
return curr != other.curr;
|
||||||
|
}
|
||||||
|
+ bool operator<(string_iterator const &other) const
|
||||||
|
+ {
|
||||||
|
+ return curr < other.curr;
|
||||||
|
+ }
|
||||||
|
+ bool operator<=(string_iterator const &other) const
|
||||||
|
+ {
|
||||||
|
+ return curr <= other.curr;
|
||||||
|
+ }
|
||||||
|
std::ptrdiff_t operator-(string_iterator const &other) const
|
||||||
|
{
|
||||||
|
return curr - other.curr;
|
||||||
|
@@ -328,9 +336,8 @@ namespace operator_
|
||||||
|
{
|
||||||
|
|
||||||
|
template <size_t N, class Arg>
|
||||||
|
- auto mod(const char (&fmt)[N],
|
||||||
|
- Arg &&arg) -> decltype(pythonic::types::str(fmt) %
|
||||||
|
- std::forward<Arg>(arg));
|
||||||
|
+ auto mod(const char (&fmt)[N], Arg &&arg)
|
||||||
|
+ -> decltype(pythonic::types::str(fmt) % std::forward<Arg>(arg));
|
||||||
|
|
||||||
|
pythonic::types::str add(char const *self, char const *other);
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
<multibuild>
|
<multibuild>
|
||||||
<package>test-py310</package>
|
|
||||||
<package>test-py311</package>
|
<package>test-py311</package>
|
||||||
<package>test-py312</package>
|
<package>test-py312</package>
|
||||||
|
<package>test-py313</package>
|
||||||
</multibuild>
|
</multibuild>
|
||||||
|
@ -1,33 +0,0 @@
|
|||||||
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):
|
|
||||||
"""
|
|
@ -1,105 +0,0 @@
|
|||||||
From 9261d30aa9618cb2a5a698d39752263b076f2d4b Mon Sep 17 00:00:00 2001
|
|
||||||
From: serge-sans-paille <serge.guelton@telecom-bretagne.eu>
|
|
||||||
Date: Tue, 20 Aug 2024 23:50:55 +0200
|
|
||||||
Subject: [PATCH] Fix numpy.fix output type
|
|
||||||
|
|
||||||
This one changed with recent numpy upgrade, see
|
|
||||||
https://github.com/numpy/numpy/pull/26766
|
|
||||||
---
|
|
||||||
pythran/pythonic/include/numpy/fix.hpp | 17 ++++++++++++++---
|
|
||||||
pythran/pythonic/numpy/fix.hpp | 6 +++---
|
|
||||||
pythran/tests/test_numpy_func0.py | 5 +++++
|
|
||||||
3 files changed, 22 insertions(+), 6 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/pythran/pythonic/include/numpy/fix.hpp b/pythran/pythonic/include/numpy/fix.hpp
|
|
||||||
index 2708930d6c..e4a85a5049 100644
|
|
||||||
--- a/pythran/pythonic/include/numpy/fix.hpp
|
|
||||||
+++ b/pythran/pythonic/include/numpy/fix.hpp
|
|
||||||
@@ -1,18 +1,29 @@
|
|
||||||
#ifndef PYTHONIC_INCLUDE_NUMPY_FIX_HPP
|
|
||||||
#define PYTHONIC_INCLUDE_NUMPY_FIX_HPP
|
|
||||||
|
|
||||||
-#include "pythonic/include/utils/functor.hpp"
|
|
||||||
#include "pythonic/include/types/ndarray.hpp"
|
|
||||||
+#include "pythonic/include/utils/functor.hpp"
|
|
||||||
#include "pythonic/include/utils/numpy_traits.hpp"
|
|
||||||
|
|
||||||
PYTHONIC_NS_BEGIN
|
|
||||||
|
|
||||||
namespace numpy
|
|
||||||
{
|
|
||||||
+ namespace wrapper
|
|
||||||
+ {
|
|
||||||
+ template <class E>
|
|
||||||
+ E fix(E const &e)
|
|
||||||
+ {
|
|
||||||
+ if (std::is_integral<E>::value)
|
|
||||||
+ return e;
|
|
||||||
+ else
|
|
||||||
+ return std::trunc(e);
|
|
||||||
+ }
|
|
||||||
+ } // namespace wrapper
|
|
||||||
#define NUMPY_NARY_FUNC_NAME fix
|
|
||||||
-#define NUMPY_NARY_FUNC_SYM std::trunc
|
|
||||||
+#define NUMPY_NARY_FUNC_SYM wrapper::fix
|
|
||||||
#include "pythonic/include/types/numpy_nary_expr.hpp"
|
|
||||||
-}
|
|
||||||
+} // namespace numpy
|
|
||||||
PYTHONIC_NS_END
|
|
||||||
|
|
||||||
#endif
|
|
||||||
diff --git a/pythran/pythonic/numpy/fix.hpp b/pythran/pythonic/numpy/fix.hpp
|
|
||||||
index 5b1b020dc2..84773b61cf 100644
|
|
||||||
--- a/pythran/pythonic/numpy/fix.hpp
|
|
||||||
+++ b/pythran/pythonic/numpy/fix.hpp
|
|
||||||
@@ -3,8 +3,8 @@
|
|
||||||
|
|
||||||
#include "pythonic/include/numpy/fix.hpp"
|
|
||||||
|
|
||||||
-#include "pythonic/utils/functor.hpp"
|
|
||||||
#include "pythonic/types/ndarray.hpp"
|
|
||||||
+#include "pythonic/utils/functor.hpp"
|
|
||||||
#include "pythonic/utils/numpy_traits.hpp"
|
|
||||||
|
|
||||||
PYTHONIC_NS_BEGIN
|
|
||||||
@@ -13,9 +13,9 @@ namespace numpy
|
|
||||||
{
|
|
||||||
|
|
||||||
#define NUMPY_NARY_FUNC_NAME fix
|
|
||||||
-#define NUMPY_NARY_FUNC_SYM std::trunc
|
|
||||||
+#define NUMPY_NARY_FUNC_SYM wrapper::fix
|
|
||||||
#include "pythonic/types/numpy_nary_expr.hpp"
|
|
||||||
-}
|
|
||||||
+} // namespace numpy
|
|
||||||
PYTHONIC_NS_END
|
|
||||||
|
|
||||||
#endif
|
|
||||||
diff --git a/pythran/tests/test_numpy_func0.py b/pythran/tests/test_numpy_func0.py
|
|
||||||
index 3e11133fec..41f716d900 100644
|
|
||||||
--- a/pythran/tests/test_numpy_func0.py
|
|
||||||
+++ b/pythran/tests/test_numpy_func0.py
|
|
||||||
@@ -1,12 +1,16 @@
|
|
||||||
import unittest
|
|
||||||
from pythran.tests import TestEnv
|
|
||||||
import numpy
|
|
||||||
+from packaging import version
|
|
||||||
import tempfile
|
|
||||||
import os
|
|
||||||
|
|
||||||
from pythran.typing import NDArray, List, Tuple
|
|
||||||
|
|
||||||
|
|
||||||
+np_version = version.parse(numpy.version.version)
|
|
||||||
+
|
|
||||||
+
|
|
||||||
class TestNumpyFunc0(TestEnv):
|
|
||||||
|
|
||||||
def test_extended_sum0(self):
|
|
||||||
@@ -910,6 +914,7 @@ def test_flatnonzero1(self):
|
|
||||||
def test_fix0(self):
|
|
||||||
self.run_test("def np_fix0(x): from numpy import fix ; return fix(x)", 3.14, np_fix0=[float])
|
|
||||||
|
|
||||||
+ @unittest.skipIf(np_version <= version.Version("2.1"), reason="np.fix used to return float on integral input")
|
|
||||||
def test_fix1(self):
|
|
||||||
self.run_test("def np_fix1(x): from numpy import fix ; return fix(x)", 3, np_fix1=[int])
|
|
||||||
|
|
@ -1,3 +1,132 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Jul 7 18:31:44 UTC 2025 - Ben Greiner <code@bnavigator.de>
|
||||||
|
|
||||||
|
- Do not run any tests on Leap 16.0 due to lack of dependencies
|
||||||
|
This is part of hplip enablement on 16.0
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed Jun 18 10:47:55 UTC 2025 - Matej Cepl <mcepl@cepl.eu>
|
||||||
|
|
||||||
|
- Skip pythran/tests/test_xdoc.py::TestDoctest::test_utils, which
|
||||||
|
is failing with 3.13.5 (gh#serge-sans-paille/pythran#2326).
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Fri Jun 13 18:54:09 UTC 2025 - Ben Greiner <code@bnavigator.de>
|
||||||
|
|
||||||
|
- Add GCC15_pythran-PR2325-missing-operators.patch
|
||||||
|
* Tracking Issues for this and the previous patch:
|
||||||
|
gcc#120622
|
||||||
|
gh#serge-sans-paille/pythran#2321
|
||||||
|
gh#serge-sans-paille/pythran#2324
|
||||||
|
gh#serge-sans-paille/pythran#2325
|
||||||
|
boo#1243779
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Thu Jun 12 10:03:44 UTC 2025 - Ana Guerrero <ana.guerrero@suse.com>
|
||||||
|
|
||||||
|
- Fix failures with GCC15:
|
||||||
|
GCC15_fix_Add-missing-operators-to-nditerator.patch
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Thu May 29 19:47:43 UTC 2025 - Ben Greiner <code@bnavigator.de>
|
||||||
|
|
||||||
|
- Update to 0.18.0 - balafenn
|
||||||
|
* no upstream changelog.
|
||||||
|
## git commits (a few non-relevant filtered)
|
||||||
|
* Fix uninitialized iexpr assignment
|
||||||
|
* Fix folding of comparison operators
|
||||||
|
* Take augassign into account when removing nested functions
|
||||||
|
* Fix local processing in presence of else: clause in for loop
|
||||||
|
* Fix detection of c++ compiler
|
||||||
|
* Traverse augassign when computing scopes
|
||||||
|
* Reproducible ContainerOf iteration
|
||||||
|
* Fix overload handling for NoneType
|
||||||
|
* Fix type inference in presence of augassign
|
||||||
|
* Improve forward substitution in presence of augassign
|
||||||
|
* Remove dead code in tests
|
||||||
|
* Faster (and common!) implementation of make_integer_sequence
|
||||||
|
* Only register a node in name_to_nodes if the combiner was
|
||||||
|
succesful
|
||||||
|
* Reproducible aliasing ordering
|
||||||
|
* Reproducible nested functions removal
|
||||||
|
* Reproducible topological order
|
||||||
|
* Verify reproducibility of c++ output
|
||||||
|
* Reproducible (because sortable) alias order
|
||||||
|
* Stateless PType
|
||||||
|
* Reproducible local declaration order
|
||||||
|
* Reproducible identifiers generation
|
||||||
|
* Reproducible include order
|
||||||
|
* More flexible implementation of default list
|
||||||
|
* Fix typing issue under complex slice combination
|
||||||
|
* Add support for nonlocal keyword
|
||||||
|
* Fix bug in nested function remover
|
||||||
|
* Cope with numpy.bool deprecation
|
||||||
|
* Be more informative about UnboundIdentifierError
|
||||||
|
* Optimize generation of cxx types
|
||||||
|
* Use inheritance instead of member type for __combined
|
||||||
|
specialization
|
||||||
|
* Remove redundant extra combiner for Assigned Subscript
|
||||||
|
* Improve nested functions support
|
||||||
|
* Harden error reporting: Do not trap when no lineno is available
|
||||||
|
* Handle folding of static_if
|
||||||
|
* Fix constness of std::get on an array_base r-value
|
||||||
|
* Make none_type hashable
|
||||||
|
* Get rid of clang workaround for containers of one element
|
||||||
|
* Simplify backend type cache & fix handling of LTypes
|
||||||
|
* Fix constness of dict's bool operator
|
||||||
|
* Specialize dict for None Key
|
||||||
|
* Drop support for builtins.None in favor of None
|
||||||
|
* Add handling of numpy.bool in tog
|
||||||
|
* replace quansight-labs/setup-python with actions/setup-python
|
||||||
|
* [ci] Dump more info when compiling system dep
|
||||||
|
* [test] Fix sign comparison code
|
||||||
|
* [ci] Test unvendoring of xsimd and boost
|
||||||
|
* Disable inlining in while test
|
||||||
|
* Python 3.13 compat: detect removed find_exe
|
||||||
|
* Fix test portability issue for ipython magic
|
||||||
|
* Adjust --cflags-pythran-only implementation
|
||||||
|
* ENH: improvements to pythran-config for build system
|
||||||
|
integration
|
||||||
|
* Have FastGExpr load its dependency in a lazy manner
|
||||||
|
* Move GIL manipulation right after module creation
|
||||||
|
* Better modeling of analyse and transformations
|
||||||
|
* Fix pythran support for numpy.float128
|
||||||
|
* Defer initialisation of global variables until the module is
|
||||||
|
actually created
|
||||||
|
* Fix interaction between static if and nested loop / function
|
||||||
|
* Allow tuple with combinable items as array initializer
|
||||||
|
* Have pythran generate freethreading compatible code
|
||||||
|
* Remove legacy logic that handled py2/py3 compatibility
|
||||||
|
* Remove any usage of __PYTHRAN__ macro
|
||||||
|
* Make sure blas function argument actually have an associated
|
||||||
|
buffer
|
||||||
|
* Provide user hint when trying to use c-style type names in
|
||||||
|
pythran spec
|
||||||
|
* [typing] Support union type in annotation
|
||||||
|
* Restore type qualifiers dropped by
|
||||||
|
b8cd84b5a5ab5222d65781a0194916ad555bf70c
|
||||||
|
* Add basic support for type annotation
|
||||||
|
* [constant folding] Correctly model restrict_assign in constant
|
||||||
|
folding
|
||||||
|
- Update test flavors
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Nov 18 18:01:06 UTC 2024 - Ben Greiner <code@bnavigator.de>
|
||||||
|
|
||||||
|
- Update to 0.17.0
|
||||||
|
* Support parsing annotated statement
|
||||||
|
* Document and test Meson integration
|
||||||
|
* Update / improve Blas detection, including scipy-openblas
|
||||||
|
* Fix usage of Blas library
|
||||||
|
* Improve error reporting
|
||||||
|
* Support array module
|
||||||
|
* Reduce dependency on setuptools
|
||||||
|
* Faster forward substitution
|
||||||
|
* Enforce default optimization level to `-O2`
|
||||||
|
- Drop upstreamed numpy-2.1-interval.patch
|
||||||
|
- Drop upstreamed numpy-2.1-support.patch
|
||||||
|
- Drop upstreamed support-gast-0.6.patch
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Sun Sep 1 13:28:40 UTC 2024 - Dirk Müller <dmueller@suse.com>
|
Sun Sep 1 13:28:40 UTC 2024 - Dirk Müller <dmueller@suse.com>
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package python-pythran
|
# spec file for package python-pythran
|
||||||
#
|
#
|
||||||
# Copyright (c) 2024 SUSE LLC
|
# Copyright (c) 2025 SUSE LLC
|
||||||
#
|
#
|
||||||
# All modifications and additions to the file contributed by third parties
|
# All modifications and additions to the file contributed by third parties
|
||||||
# remain the property of their copyright owners, unless otherwise agreed
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
@ -25,9 +25,6 @@
|
|||||||
%else
|
%else
|
||||||
%define psuffix -%{flavor}
|
%define psuffix -%{flavor}
|
||||||
%bcond_without test
|
%bcond_without test
|
||||||
%if "%{flavor}" != "test-py310"
|
|
||||||
%define skip_python310 1
|
|
||||||
%endif
|
|
||||||
%if "%{flavor}" != "test-py311"
|
%if "%{flavor}" != "test-py311"
|
||||||
%define skip_python311 1
|
%define skip_python311 1
|
||||||
%endif
|
%endif
|
||||||
@ -37,8 +34,8 @@
|
|||||||
%if "%{flavor}" != "test-py313"
|
%if "%{flavor}" != "test-py313"
|
||||||
%define skip_python313 1
|
%define skip_python313 1
|
||||||
%endif
|
%endif
|
||||||
# Skip empty buildsets, last one is for sle15_python_module_pythons
|
# Skip empty buildsets on tumbleweed, or non py311 flavors on sle15_python_module_pythons, or any testing on leap 16
|
||||||
%if "%{shrink:%{pythons}}" == "" || ("%pythons" == "python311" && 0%{?skip_python311})
|
%if "%{shrink:%{pythons}}" == "" || ("%pythons" == "python311" && 0%{?skip_python311}) || (0%{?is_opensuse} && 0%{?suse_version} == 1600)
|
||||||
ExclusiveArch: donotbuild
|
ExclusiveArch: donotbuild
|
||||||
%define python_module() %flavor-not-enabled-in-buildset-for-suse-%{?suse_version}
|
%define python_module() %flavor-not-enabled-in-buildset-for-suse-%{?suse_version}
|
||||||
%else
|
%else
|
||||||
@ -47,7 +44,7 @@ ExclusiveArch: x86_64
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
Name: python-pythran%{psuffix}
|
Name: python-pythran%{psuffix}
|
||||||
Version: 0.16.1
|
Version: 0.18.0
|
||||||
Release: 0
|
Release: 0
|
||||||
Summary: Ahead of Time compiler for numeric kernels
|
Summary: Ahead of Time compiler for numeric kernels
|
||||||
License: BSD-3-Clause
|
License: BSD-3-Clause
|
||||||
@ -55,10 +52,10 @@ URL: https://github.com/serge-sans-paille/pythran
|
|||||||
# Tests are only availble from the github archive
|
# Tests are only availble from the github archive
|
||||||
Source0: https://github.com/serge-sans-paille/pythran/archive/refs/tags/%{version}.tar.gz#/pythran-%{version}-gh.tar.gz
|
Source0: https://github.com/serge-sans-paille/pythran/archive/refs/tags/%{version}.tar.gz#/pythran-%{version}-gh.tar.gz
|
||||||
Source99: python-pythran-rpmlintrc
|
Source99: python-pythran-rpmlintrc
|
||||||
# PATCH-FIX-UPSTREAM gh#serge-sans-paille/pythran#840a0e706ec39963aec6bcd1f118bf33177c20b4
|
# PATCH-FIX-UPSTREAM: https://github.com/serge-sans-paille/pythran/commit/14b78f0db9cbd253414b751d14644843354e7557
|
||||||
Patch0: support-gast-0.6.patch
|
Patch0: GCC15_fix_Add-missing-operators-to-nditerator.patch
|
||||||
Patch1: https://github.com/serge-sans-paille/pythran/pull/2231/commits/9261d30aa9618cb2a5a698d39752263b076f2d4b.patch#/numpy-2.1-support.patch
|
# PATCH-FIX-UPSTREAM: https://github.com/serge-sans-paille/pythran/commit/623fa5031df7ec5c3dfe6789bf608cf11ac95c36
|
||||||
Patch2: https://github.com/serge-sans-paille/pythran/commit/6b61e8a6b3dddab13b88e51309cbdf2f28247960.patch#/numpy-2.1-interval.patch
|
Patch1: GCC15_pythran-PR2325-missing-operators.patch
|
||||||
BuildRequires: %{python_module pip}
|
BuildRequires: %{python_module pip}
|
||||||
BuildRequires: %{python_module setuptools}
|
BuildRequires: %{python_module setuptools}
|
||||||
BuildRequires: %{python_module wheel}
|
BuildRequires: %{python_module wheel}
|
||||||
@ -138,8 +135,11 @@ libs=openblas
|
|||||||
EOF
|
EOF
|
||||||
export PYTHRANRC=$PWD/config.pythranrc
|
export PYTHRANRC=$PWD/config.pythranrc
|
||||||
%endif
|
%endif
|
||||||
|
# gh#serge-sans-paille/pythran#2317 -- changed AST in Py3.13
|
||||||
|
# gh#serge-sans-paille/pythran#2326
|
||||||
|
python313_skip_tests=("-k" "not (test_tutorial or test_utils)")
|
||||||
# pytest_extra_args is for debug builds with local defines on command line
|
# pytest_extra_args is for debug builds with local defines on command line
|
||||||
%pytest %{?jobs:-n %jobs} %{?pytest_extra_args}
|
%pytest %{?jobs:-n %jobs} %{?pytest_extra_args} "${$python_skip_tests[@]}"
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%if !%{with test}
|
%if !%{with test}
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:a2510f370a7d62761844daa112a455785e5a6a216cf9ae704c3926fe68eb65ce
|
|
||||||
size 3680817
|
|
3
pythran-0.18.0-gh.tar.gz
Normal file
3
pythran-0.18.0-gh.tar.gz
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:d3f879f86fde1c0eb62e02e52fbe30e2468fb59d8751b951b7cc6faf16e7df3e
|
||||||
|
size 3707538
|
@ -1,76 +0,0 @@
|
|||||||
From 840a0e706ec39963aec6bcd1f118bf33177c20b4 Mon Sep 17 00:00:00 2001
|
|
||||||
From: serge-sans-paille <serge.guelton@telecom-bretagne.eu>
|
|
||||||
Date: Sat, 29 Jun 2024 19:13:02 +0200
|
|
||||||
Subject: [PATCH] Bump gast requirement to 0.6.0
|
|
||||||
|
|
||||||
This mostly helps for harmonious behavior wrt. gast.dump
|
|
||||||
---
|
|
||||||
docs/TUTORIAL.rst | 8 ++++----
|
|
||||||
pythran/utils.py | 2 +-
|
|
||||||
requirements.txt | 2 +-
|
|
||||||
3 files changed, 6 insertions(+), 6 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/docs/TUTORIAL.rst b/docs/TUTORIAL.rst
|
|
||||||
index 09f6902f9..7692547eb 100644
|
|
||||||
--- a/docs/TUTORIAL.rst
|
|
||||||
+++ b/docs/TUTORIAL.rst
|
|
||||||
@@ -20,7 +20,7 @@ Python ships a standard module, ``ast`` to turn Python code into an AST. For ins
|
|
||||||
>>> code = "a=1"
|
|
||||||
>>> tree = ast.parse(code) # turn the code into an AST
|
|
||||||
>>> print(ast.dump(tree)) # view it as a string
|
|
||||||
- Module(body=[Assign(targets=[Name(id='a', ctx=Store(), annotation=None, type_comment=None)], value=Constant(value=1, kind=None), type_comment=None)], type_ignores=[])
|
|
||||||
+ Module(body=[Assign(targets=[Name(id='a', ctx=Store())], value=Constant(value=1, kind=None))])
|
|
||||||
|
|
||||||
Deciphering the above line, one learns that the single assignment is parsed as
|
|
||||||
a module containing a single statement, which is an assignment to a single
|
|
||||||
@@ -33,7 +33,7 @@ Eventually, one needs to parse more complex codes, and things get a bit more cry
|
|
||||||
... return n if n< 2 else fib(n-1) + fib(n-2)"""
|
|
||||||
>>> tree = ast.parse(fib_src)
|
|
||||||
>>> print(ast.dump(tree))
|
|
||||||
- Module(body=[FunctionDef(name='fib', args=arguments(args=[Name(id='n', ctx=Param(), annotation=None, type_comment=None)], posonlyargs=[], vararg=None, kwonlyargs=[], kw_defaults=[], kwarg=None, defaults=[]), body=[Return(value=IfExp(test=Compare(left=Name(id='n', ctx=Load(), annotation=None, type_comment=None), ops=[Lt()], comparators=[Constant(value=2, kind=None)]), body=Name(id='n', ctx=Load(), annotation=None, type_comment=None), orelse=BinOp(left=Call(func=Name(id='fib', ctx=Load(), annotation=None, type_comment=None), args=[BinOp(left=Name(id='n', ctx=Load(), annotation=None, type_comment=None), op=Sub(), right=Constant(value=1, kind=None))], keywords=[]), op=Add(), right=Call(func=Name(id='fib', ctx=Load(), annotation=None, type_comment=None), args=[BinOp(left=Name(id='n', ctx=Load(), annotation=None, type_comment=None), op=Sub(), right=Constant(value=2, kind=None))], keywords=[]))))], decorator_list=[], returns=None, type_comment=None)], type_ignores=[])
|
|
||||||
+ Module(body=[FunctionDef(name='fib', args=arguments(args=[Name(id='n', ctx=Param())]), body=[Return(value=IfExp(test=Compare(left=Name(id='n', ctx=Load()), ops=[Lt()], comparators=[Constant(value=2, kind=None)]), body=Name(id='n', ctx=Load()), orelse=BinOp(left=Call(func=Name(id='fib', ctx=Load()), args=[BinOp(left=Name(id='n', ctx=Load()), op=Sub(), right=Constant(value=1, kind=None))]), op=Add(), right=Call(func=Name(id='fib', ctx=Load()), args=[BinOp(left=Name(id='n', ctx=Load()), op=Sub(), right=Constant(value=2, kind=None))]))))])])
|
|
||||||
|
|
||||||
The idea remains the same. The whole Python syntax is described in
|
|
||||||
http://docs.python.org/2/library/ast.html and is worth a glance, otherwise
|
|
||||||
@@ -199,7 +199,7 @@ constant expressions. In the previous code, there is only two constant
|
|
||||||
|
|
||||||
>>> ce = pm.gather(analyses.ConstantExpressions, tree)
|
|
||||||
>>> sorted(map(ast.dump, ce))
|
|
||||||
- ["Attribute(value=Name(id='math', ctx=Load(), annotation=None, type_comment=None), attr='cos', ctx=Load())", 'Constant(value=3, kind=None)']
|
|
||||||
+ ["Attribute(value=Name(id='math', ctx=Load()), attr='cos', ctx=Load())", 'Constant(value=3, kind=None)']
|
|
||||||
|
|
||||||
One of the most critical analyse of Pythran is the points-to analysis. There
|
|
||||||
are two flavors of this analyse, one that computes an over-set of the aliased
|
|
||||||
@@ -210,7 +210,7 @@ variable, and one that computes an under set. ``Aliases`` computes an over-set::
|
|
||||||
>>> al = pm.gather(analyses.Aliases, tree)
|
|
||||||
>>> returned = tree.body[-1].body[-1].value
|
|
||||||
>>> print(ast.dump(returned))
|
|
||||||
- Name(id='b', ctx=Load(), annotation=None, type_comment=None)
|
|
||||||
+ Name(id='b', ctx=Load())
|
|
||||||
>>> sorted(a.id for a in al[returned])
|
|
||||||
['c', 'd']
|
|
||||||
|
|
||||||
diff --git a/pythran/utils.py b/pythran/utils.py
|
|
||||||
index 2d7a67327..55a7e8ad6 100644
|
|
||||||
--- a/pythran/utils.py
|
|
||||||
+++ b/pythran/utils.py
|
|
||||||
@@ -106,7 +106,7 @@ def get_variable(assignable):
|
|
||||||
... slice=ast.Name('j', ast.Load(), None, None),
|
|
||||||
... ctx=ast.Load())
|
|
||||||
>>> ast.dump(get_variable(ref))
|
|
||||||
- "Name(id='a', ctx=Load(), annotation=None, type_comment=None)"
|
|
||||||
+ "Name(id='a', ctx=Load())"
|
|
||||||
"""
|
|
||||||
msg = "Only name and subscript can be assigned."
|
|
||||||
assert isinstance(assignable, (ast.Name, ast.Subscript)), msg
|
|
||||||
diff --git a/requirements.txt b/requirements.txt
|
|
||||||
index fd6a738e5..c7a25c52a 100644
|
|
||||||
--- a/requirements.txt
|
|
||||||
+++ b/requirements.txt
|
|
||||||
@@ -1,5 +1,5 @@
|
|
||||||
ply>=3.4
|
|
||||||
setuptools
|
|
||||||
-gast~=0.5.0
|
|
||||||
+gast~=0.6.0
|
|
||||||
numpy
|
|
||||||
beniget~=0.4.0
|
|
Reference in New Issue
Block a user