From 382f6f59efa46a738197beb25b8b9b55937142d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Mon, 9 Dec 2019 11:23:10 +0100 Subject: [PATCH] Fix 32bit arches --- ...a91f3d2cf9a863afeb6aae5ca20c0ca2e2c3.patch | 48 + ...1d3d6e11d00c8c839adcc2694820ecfa519e.patch | 864 ++++++++++++++++++ pythran.spec | 5 + 3 files changed, 917 insertions(+) create mode 100644 2be7a91f3d2cf9a863afeb6aae5ca20c0ca2e2c3.patch create mode 100644 b0501d3d6e11d00c8c839adcc2694820ecfa519e.patch diff --git a/2be7a91f3d2cf9a863afeb6aae5ca20c0ca2e2c3.patch b/2be7a91f3d2cf9a863afeb6aae5ca20c0ca2e2c3.patch new file mode 100644 index 0000000..12b7dfb --- /dev/null +++ b/2be7a91f3d2cf9a863afeb6aae5ca20c0ca2e2c3.patch @@ -0,0 +1,48 @@ +From 2be7a91f3d2cf9a863afeb6aae5ca20c0ca2e2c3 Mon Sep 17 00:00:00 2001 +From: serge-sans-paille +Date: Tue, 10 Dec 2019 09:48:46 +0100 +Subject: [PATCH] Fix implicit conversion for unary operator+ + +--- + pythran/pythonic/include/operator_/pos.hpp | 4 ++++ + pythran/pythonic/operator_/pos.hpp | 12 ++++++++++++ + 2 files changed, 16 insertions(+) + +diff --git a/pythran/pythonic/include/operator_/pos.hpp b/pythran/pythonic/include/operator_/pos.hpp +index d2e83cfa0..0cb1dad81 100644 +--- a/pythran/pythonic/include/operator_/pos.hpp ++++ b/pythran/pythonic/include/operator_/pos.hpp +@@ -11,6 +11,10 @@ namespace operator_ + template + auto pos(A const &a) -> decltype(+a); + ++ char pos(char const& a); ++ signed char pos(signed char const& a); ++ unsigned char pos(unsigned char const& a); ++ + DEFINE_FUNCTOR(pythonic::operator_, pos); + } + PYTHONIC_NS_END +diff --git a/pythran/pythonic/operator_/pos.hpp b/pythran/pythonic/operator_/pos.hpp +index 5428ecbd8..53933074c 100644 +--- a/pythran/pythonic/operator_/pos.hpp ++++ b/pythran/pythonic/operator_/pos.hpp +@@ -15,6 +15,18 @@ namespace operator_ + { + return +a; + } ++ ++ char pos(char const& a) { ++ return +a; ++ } ++ ++ signed char pos(signed char const& a) { ++ return +a; ++ } ++ ++ unsigned char pos(unsigned char const& a) { ++ return +a; ++ } + } + PYTHONIC_NS_END + diff --git a/b0501d3d6e11d00c8c839adcc2694820ecfa519e.patch b/b0501d3d6e11d00c8c839adcc2694820ecfa519e.patch new file mode 100644 index 0000000..1dd430b --- /dev/null +++ b/b0501d3d6e11d00c8c839adcc2694820ecfa519e.patch @@ -0,0 +1,864 @@ +From b0501d3d6e11d00c8c839adcc2694820ecfa519e Mon Sep 17 00:00:00 2001 +From: serge-sans-paille +Date: Sun, 8 Dec 2019 21:36:38 +0100 +Subject: [PATCH] Support more numpy type conversion operators + +--- + pythran/pythonic/__builtin__/type.hpp | 58 ++++++++++++-------- + pythran/pythonic/include/numpy/byte.hpp | 29 ++++++++++ + pythran/pythonic/include/numpy/int_.hpp | 28 ++++++++++ + pythran/pythonic/include/numpy/longlong.hpp | 29 ++++++++++ + pythran/pythonic/include/numpy/short_.hpp | 29 ++++++++++ + pythran/pythonic/include/numpy/ubyte.hpp | 20 ++++++- + pythran/pythonic/include/numpy/uint.hpp | 28 ++++++++++ + pythran/pythonic/include/numpy/ulonglong.hpp | 29 ++++++++++ + pythran/pythonic/include/numpy/ushort.hpp | 29 ++++++++++ + pythran/pythonic/include/types/int.hpp | 1 + + pythran/pythonic/numpy/byte.hpp | 37 +++++++++++++ + pythran/pythonic/numpy/int_.hpp | 37 +++++++++++++ + pythran/pythonic/numpy/longlong.hpp | 37 +++++++++++++ + pythran/pythonic/numpy/short_.hpp | 37 +++++++++++++ + pythran/pythonic/numpy/ubyte.hpp | 32 ++++++++++- + pythran/pythonic/numpy/uint.hpp | 37 +++++++++++++ + pythran/pythonic/numpy/ulonglong.hpp | 37 +++++++++++++ + pythran/pythonic/numpy/ushort.hpp | 37 +++++++++++++ + pythran/pythonic/types/int.hpp | 5 ++ + pythran/tables.py | 6 ++ + pythran/tests/test_ndarray.py | 15 +++++ + 21 files changed, 570 insertions(+), 27 deletions(-) + create mode 100644 pythran/pythonic/include/numpy/byte.hpp + create mode 100644 pythran/pythonic/include/numpy/int_.hpp + create mode 100644 pythran/pythonic/include/numpy/longlong.hpp + create mode 100644 pythran/pythonic/include/numpy/short_.hpp + create mode 100644 pythran/pythonic/include/numpy/uint.hpp + create mode 100644 pythran/pythonic/include/numpy/ulonglong.hpp + create mode 100644 pythran/pythonic/include/numpy/ushort.hpp + create mode 100644 pythran/pythonic/numpy/byte.hpp + create mode 100644 pythran/pythonic/numpy/int_.hpp + create mode 100644 pythran/pythonic/numpy/longlong.hpp + create mode 100644 pythran/pythonic/numpy/short_.hpp + create mode 100644 pythran/pythonic/numpy/uint.hpp + create mode 100644 pythran/pythonic/numpy/ulonglong.hpp + create mode 100644 pythran/pythonic/numpy/ushort.hpp + +diff --git a/pythran/pythonic/__builtin__/type.hpp b/pythran/pythonic/__builtin__/type.hpp +index f222597a4..04232b0f8 100644 +--- a/pythran/pythonic/__builtin__/type.hpp ++++ b/pythran/pythonic/__builtin__/type.hpp +@@ -15,14 +15,16 @@ + #include "pythonic/__builtin__/dict.hpp" + #include "pythonic/__builtin__/tuple.hpp" + #include "pythonic/numpy/array.hpp" +-#include "pythonic/numpy/int8.hpp" +-#include "pythonic/numpy/uint8.hpp" +-#include "pythonic/numpy/int16.hpp" +-#include "pythonic/numpy/uint16.hpp" +-#include "pythonic/numpy/int32.hpp" +-#include "pythonic/numpy/uint32.hpp" +-#include "pythonic/numpy/int64.hpp" +-#include "pythonic/numpy/uint64.hpp" ++#include "pythonic/numpy/byte.hpp" ++#include "pythonic/numpy/ubyte.hpp" ++#include "pythonic/numpy/short_.hpp" ++#include "pythonic/numpy/ushort.hpp" ++#include "pythonic/numpy/intc.hpp" ++#include "pythonic/numpy/uintc.hpp" ++#include "pythonic/numpy/int_.hpp" ++#include "pythonic/numpy/uint.hpp" ++#include "pythonic/numpy/longlong.hpp" ++#include "pythonic/numpy/ulonglong.hpp" + #include "pythonic/numpy/float32.hpp" + #include "pythonic/numpy/float128.hpp" + +@@ -87,36 +89,44 @@ namespace __builtin__ + using type = numpy::functor::array; + }; + template <> +- struct type_functor { +- using type = numpy::functor::int8; ++ struct type_functor { ++ using type = numpy::functor::byte; + }; + template <> +- struct type_functor { +- using type = numpy::functor::uint8; ++ struct type_functor { ++ using type = numpy::functor::ubyte; + }; + template <> +- struct type_functor { +- using type = numpy::functor::int16; ++ struct type_functor { ++ using type = numpy::functor::short_; + }; + template <> +- struct type_functor { +- using type = numpy::functor::uint16; ++ struct type_functor { ++ using type = numpy::functor::ushort; + }; + template <> +- struct type_functor { +- using type = numpy::functor::int32; ++ struct type_functor { ++ using type = numpy::functor::intc; + }; + template <> +- struct type_functor { +- using type = numpy::functor::uint32; ++ struct type_functor { ++ using type = numpy::functor::uintc; + }; + template <> +- struct type_functor { +- using type = numpy::functor::int64; ++ struct type_functor { ++ using type = numpy::functor::int_; + }; + template <> +- struct type_functor { +- using type = numpy::functor::uint64; ++ struct type_functor { ++ using type = numpy::functor::uint; ++ }; ++ template <> ++ struct type_functor { ++ using type = numpy::functor::longlong; ++ }; ++ template <> ++ struct type_functor { ++ using type = numpy::functor::ulonglong; + }; + template <> + struct type_functor { +diff --git a/pythran/pythonic/include/numpy/byte.hpp b/pythran/pythonic/include/numpy/byte.hpp +new file mode 100644 +index 000000000..79f388e5a +--- /dev/null ++++ b/pythran/pythonic/include/numpy/byte.hpp +@@ -0,0 +1,29 @@ ++#ifndef PYTHONIC_INCLUDE_NUMPY_BYTE_HPP ++#define PYTHONIC_INCLUDE_NUMPY_BYTE_HPP ++ ++#include "pythonic/include/utils/functor.hpp" ++#include "pythonic/include/utils/meta.hpp" ++#include "pythonic/include/utils/numpy_traits.hpp" ++#include "pythonic/include/types/numpy_op_helper.hpp" ++ ++PYTHONIC_NS_BEGIN ++ ++namespace numpy ++{ ++ ++ namespace details ++ { ++ ++ char byte(); ++ template ++ char byte(V v); ++ } ++ ++#define NUMPY_NARY_FUNC_NAME byte ++#define NUMPY_NARY_FUNC_SYM details::byte ++#define NUMPY_NARY_EXTRA_METHOD using type = char; ++#include "pythonic/include/types/numpy_nary_expr.hpp" ++} ++PYTHONIC_NS_END ++ ++#endif +diff --git a/pythran/pythonic/include/numpy/int_.hpp b/pythran/pythonic/include/numpy/int_.hpp +new file mode 100644 +index 000000000..57df3fe4b +--- /dev/null ++++ b/pythran/pythonic/include/numpy/int_.hpp +@@ -0,0 +1,28 @@ ++#ifndef PYTHONIC_INCLUDE_NUMPY_INT__HPP ++#define PYTHONIC_INCLUDE_NUMPY_INT__HPP ++ ++#include "pythonic/include/utils/functor.hpp" ++#include "pythonic/include/utils/meta.hpp" ++#include "pythonic/include/utils/numpy_traits.hpp" ++#include "pythonic/include/types/numpy_op_helper.hpp" ++ ++PYTHONIC_NS_BEGIN ++ ++namespace numpy ++{ ++ ++ namespace details ++ { ++ long int_(); ++ template ++ long int_(V v); ++ } ++ ++#define NUMPY_NARY_FUNC_NAME int_ ++#define NUMPY_NARY_FUNC_SYM details::int_ ++#define NUMPY_NARY_EXTRA_METHOD using type = long; ++#include "pythonic/include/types/numpy_nary_expr.hpp" ++} ++PYTHONIC_NS_END ++ ++#endif +diff --git a/pythran/pythonic/include/numpy/longlong.hpp b/pythran/pythonic/include/numpy/longlong.hpp +new file mode 100644 +index 000000000..cde5bf455 +--- /dev/null ++++ b/pythran/pythonic/include/numpy/longlong.hpp +@@ -0,0 +1,29 @@ ++#ifndef PYTHONIC_INCLUDE_NUMPY_LONGLONG_HPP ++#define PYTHONIC_INCLUDE_NUMPY_LONGLONG_HPP ++ ++#include "pythonic/include/utils/functor.hpp" ++#include "pythonic/include/utils/meta.hpp" ++#include "pythonic/include/utils/numpy_traits.hpp" ++#include "pythonic/include/types/numpy_op_helper.hpp" ++ ++PYTHONIC_NS_BEGIN ++ ++namespace numpy ++{ ++ ++ namespace details ++ { ++ ++ long long longlong(); ++ template ++ long long longlong(V v); ++ } ++ ++#define NUMPY_NARY_FUNC_NAME longlong ++#define NUMPY_NARY_FUNC_SYM details::longlong ++#define NUMPY_NARY_EXTRA_METHOD using type = long long; ++#include "pythonic/include/types/numpy_nary_expr.hpp" ++} ++PYTHONIC_NS_END ++ ++#endif +diff --git a/pythran/pythonic/include/numpy/short_.hpp b/pythran/pythonic/include/numpy/short_.hpp +new file mode 100644 +index 000000000..74e744368 +--- /dev/null ++++ b/pythran/pythonic/include/numpy/short_.hpp +@@ -0,0 +1,29 @@ ++#ifndef PYTHONIC_INCLUDE_NUMPY_SHORT__HPP ++#define PYTHONIC_INCLUDE_NUMPY_SHORT__HPP ++ ++#include "pythonic/include/utils/functor.hpp" ++#include "pythonic/include/utils/meta.hpp" ++#include "pythonic/include/utils/numpy_traits.hpp" ++#include "pythonic/include/types/numpy_op_helper.hpp" ++ ++PYTHONIC_NS_BEGIN ++ ++namespace numpy ++{ ++ ++ namespace details ++ { ++ ++ short short_(); ++ template ++ short short_(V v); ++ } ++ ++#define NUMPY_NARY_FUNC_NAME short_ ++#define NUMPY_NARY_FUNC_SYM details::short_ ++#define NUMPY_NARY_EXTRA_METHOD using type = short; ++#include "pythonic/include/types/numpy_nary_expr.hpp" ++} ++PYTHONIC_NS_END ++ ++#endif +diff --git a/pythran/pythonic/include/numpy/ubyte.hpp b/pythran/pythonic/include/numpy/ubyte.hpp +index 7cf72a3c7..51327e593 100644 +--- a/pythran/pythonic/include/numpy/ubyte.hpp ++++ b/pythran/pythonic/include/numpy/ubyte.hpp +@@ -1,12 +1,28 @@ + #ifndef PYTHONIC_INCLUDE_NUMPY_UBYTE_HPP + #define PYTHONIC_INCLUDE_NUMPY_UBYTE_HPP + +-#include "pythonic/include/numpy/uint8.hpp" ++#include "pythonic/include/utils/functor.hpp" ++#include "pythonic/include/utils/meta.hpp" ++#include "pythonic/include/utils/numpy_traits.hpp" ++#include "pythonic/include/types/numpy_op_helper.hpp" + + PYTHONIC_NS_BEGIN ++ + namespace numpy + { +- USING_FUNCTOR(ubyte, uint8); ++ ++ namespace details ++ { ++ ++ unsigned char ubyte(); ++ template ++ unsigned char ubyte(V v); ++ } ++ ++#define NUMPY_NARY_FUNC_NAME ubyte ++#define NUMPY_NARY_FUNC_SYM details::ubyte ++#define NUMPY_NARY_EXTRA_METHOD using type = unsigned char; ++#include "pythonic/include/types/numpy_nary_expr.hpp" + } + PYTHONIC_NS_END + +diff --git a/pythran/pythonic/include/numpy/uint.hpp b/pythran/pythonic/include/numpy/uint.hpp +new file mode 100644 +index 000000000..ec4773dae +--- /dev/null ++++ b/pythran/pythonic/include/numpy/uint.hpp +@@ -0,0 +1,28 @@ ++#ifndef PYTHONIC_INCLUDE_NUMPY_UINT_HPP ++#define PYTHONIC_INCLUDE_NUMPY_UINT_HPP ++ ++#include "pythonic/include/utils/functor.hpp" ++#include "pythonic/include/utils/meta.hpp" ++#include "pythonic/include/utils/numpy_traits.hpp" ++#include "pythonic/include/types/numpy_op_helper.hpp" ++ ++PYTHONIC_NS_BEGIN ++ ++namespace numpy ++{ ++ ++ namespace details ++ { ++ unsigned long uint(); ++ template ++ unsigned long uint(V v); ++ } ++ ++#define NUMPY_NARY_FUNC_NAME uint ++#define NUMPY_NARY_FUNC_SYM details::uint ++#define NUMPY_NARY_EXTRA_METHOD using type = unsigned long; ++#include "pythonic/include/types/numpy_nary_expr.hpp" ++} ++PYTHONIC_NS_END ++ ++#endif +diff --git a/pythran/pythonic/include/numpy/ulonglong.hpp b/pythran/pythonic/include/numpy/ulonglong.hpp +new file mode 100644 +index 000000000..8811bd2cc +--- /dev/null ++++ b/pythran/pythonic/include/numpy/ulonglong.hpp +@@ -0,0 +1,29 @@ ++#ifndef PYTHONIC_INCLUDE_NUMPY_ULONGLONG_HPP ++#define PYTHONIC_INCLUDE_NUMPY_ULONGLONG_HPP ++ ++#include "pythonic/include/utils/functor.hpp" ++#include "pythonic/include/utils/meta.hpp" ++#include "pythonic/include/utils/numpy_traits.hpp" ++#include "pythonic/include/types/numpy_op_helper.hpp" ++ ++PYTHONIC_NS_BEGIN ++ ++namespace numpy ++{ ++ ++ namespace details ++ { ++ ++ unsigned long long ulonglong(); ++ template ++ unsigned long long ulonglong(V v); ++ } ++ ++#define NUMPY_NARY_FUNC_NAME ulonglong ++#define NUMPY_NARY_FUNC_SYM details::ulonglong ++#define NUMPY_NARY_EXTRA_METHOD using type = unsigned long long; ++#include "pythonic/include/types/numpy_nary_expr.hpp" ++} ++PYTHONIC_NS_END ++ ++#endif +diff --git a/pythran/pythonic/include/numpy/ushort.hpp b/pythran/pythonic/include/numpy/ushort.hpp +new file mode 100644 +index 000000000..11d298001 +--- /dev/null ++++ b/pythran/pythonic/include/numpy/ushort.hpp +@@ -0,0 +1,29 @@ ++#ifndef PYTHONIC_INCLUDE_NUMPY_USHORT_HPP ++#define PYTHONIC_INCLUDE_NUMPY_USHORT_HPP ++ ++#include "pythonic/include/utils/functor.hpp" ++#include "pythonic/include/utils/meta.hpp" ++#include "pythonic/include/utils/numpy_traits.hpp" ++#include "pythonic/include/types/numpy_op_helper.hpp" ++ ++PYTHONIC_NS_BEGIN ++ ++namespace numpy ++{ ++ ++ namespace details ++ { ++ ++ unsigned short ushort(); ++ template ++ unsigned short ushort(V v); ++ } ++ ++#define NUMPY_NARY_FUNC_NAME ushort ++#define NUMPY_NARY_FUNC_SYM details::ushort ++#define NUMPY_NARY_EXTRA_METHOD using type = unsigned short; ++#include "pythonic/include/types/numpy_nary_expr.hpp" ++} ++PYTHONIC_NS_END ++ ++#endif +diff --git a/pythran/pythonic/include/types/int.hpp b/pythran/pythonic/include/types/int.hpp +index 003f9d59e..56b27bc53 100644 +--- a/pythran/pythonic/include/types/int.hpp ++++ b/pythran/pythonic/include/types/int.hpp +@@ -26,6 +26,7 @@ PYTHONIC_NS_BEGIN + static PyObject *convert(TYPE l); \ + } + ++PYTHONIC_INT_TO_PYTHON(char); + PYTHONIC_INT_TO_PYTHON(unsigned char); + PYTHONIC_INT_TO_PYTHON(signed char); + PYTHONIC_INT_TO_PYTHON(unsigned short); +diff --git a/pythran/pythonic/numpy/byte.hpp b/pythran/pythonic/numpy/byte.hpp +new file mode 100644 +index 000000000..423b280d2 +--- /dev/null ++++ b/pythran/pythonic/numpy/byte.hpp +@@ -0,0 +1,37 @@ ++#ifndef PYTHONIC_NUMPY_BYTE_HPP ++#define PYTHONIC_NUMPY_BYTE_HPP ++ ++#include "pythonic/include/numpy/byte.hpp" ++ ++#include "pythonic/utils/functor.hpp" ++#include "pythonic/utils/meta.hpp" ++#include "pythonic/utils/numpy_traits.hpp" ++#include "pythonic/types/numpy_op_helper.hpp" ++ ++PYTHONIC_NS_BEGIN ++ ++namespace numpy ++{ ++ ++ namespace details ++ { ++ ++ char byte() ++ { ++ return {}; ++ } ++ ++ template ++ char byte(V v) ++ { ++ return v; ++ } ++ } ++ ++#define NUMPY_NARY_FUNC_NAME byte ++#define NUMPY_NARY_FUNC_SYM details::byte ++#include "pythonic/types/numpy_nary_expr.hpp" ++} ++PYTHONIC_NS_END ++ ++#endif +diff --git a/pythran/pythonic/numpy/int_.hpp b/pythran/pythonic/numpy/int_.hpp +new file mode 100644 +index 000000000..3854b44eb +--- /dev/null ++++ b/pythran/pythonic/numpy/int_.hpp +@@ -0,0 +1,37 @@ ++#ifndef PYTHONIC_NUMPY_INT__HPP ++#define PYTHONIC_NUMPY_INT__HPP ++ ++#include "pythonic/include/numpy/int_.hpp" ++ ++#include "pythonic/utils/functor.hpp" ++#include "pythonic/utils/meta.hpp" ++#include "pythonic/utils/numpy_traits.hpp" ++#include "pythonic/types/numpy_op_helper.hpp" ++ ++PYTHONIC_NS_BEGIN ++ ++namespace numpy ++{ ++ ++ namespace details ++ { ++ ++ long int_() ++ { ++ return {}; ++ } ++ ++ template ++ long int_(V v) ++ { ++ return v; ++ } ++ } ++ ++#define NUMPY_NARY_FUNC_NAME int_ ++#define NUMPY_NARY_FUNC_SYM details::int_ ++#include "pythonic/types/numpy_nary_expr.hpp" ++} ++PYTHONIC_NS_END ++ ++#endif +diff --git a/pythran/pythonic/numpy/longlong.hpp b/pythran/pythonic/numpy/longlong.hpp +new file mode 100644 +index 000000000..00623cba1 +--- /dev/null ++++ b/pythran/pythonic/numpy/longlong.hpp +@@ -0,0 +1,37 @@ ++#ifndef PYTHONIC_NUMPY_LONGLONG_HPP ++#define PYTHONIC_NUMPY_LONGLONG_HPP ++ ++#include "pythonic/include/numpy/longlong.hpp" ++ ++#include "pythonic/utils/functor.hpp" ++#include "pythonic/utils/meta.hpp" ++#include "pythonic/utils/numpy_traits.hpp" ++#include "pythonic/types/numpy_op_helper.hpp" ++ ++PYTHONIC_NS_BEGIN ++ ++namespace numpy ++{ ++ ++ namespace details ++ { ++ ++ long long longlong() ++ { ++ return {}; ++ } ++ ++ template ++ long long longlong(V v) ++ { ++ return v; ++ } ++ } ++ ++#define NUMPY_NARY_FUNC_NAME longlong ++#define NUMPY_NARY_FUNC_SYM details::longlong ++#include "pythonic/types/numpy_nary_expr.hpp" ++} ++PYTHONIC_NS_END ++ ++#endif +diff --git a/pythran/pythonic/numpy/short_.hpp b/pythran/pythonic/numpy/short_.hpp +new file mode 100644 +index 000000000..0e29f34b9 +--- /dev/null ++++ b/pythran/pythonic/numpy/short_.hpp +@@ -0,0 +1,37 @@ ++#ifndef PYTHONIC_NUMPY_SHORT__HPP ++#define PYTHONIC_NUMPY_SHORT__HPP ++ ++#include "pythonic/include/numpy/short_.hpp" ++ ++#include "pythonic/utils/functor.hpp" ++#include "pythonic/utils/meta.hpp" ++#include "pythonic/utils/numpy_traits.hpp" ++#include "pythonic/types/numpy_op_helper.hpp" ++ ++PYTHONIC_NS_BEGIN ++ ++namespace numpy ++{ ++ ++ namespace details ++ { ++ ++ short short_() ++ { ++ return {}; ++ } ++ ++ template ++ short short_(V v) ++ { ++ return v; ++ } ++ } ++ ++#define NUMPY_NARY_FUNC_NAME short_ ++#define NUMPY_NARY_FUNC_SYM details::short_ ++#include "pythonic/types/numpy_nary_expr.hpp" ++} ++PYTHONIC_NS_END ++ ++#endif +diff --git a/pythran/pythonic/numpy/ubyte.hpp b/pythran/pythonic/numpy/ubyte.hpp +index 1838b375b..c9718aadb 100644 +--- a/pythran/pythonic/numpy/ubyte.hpp ++++ b/pythran/pythonic/numpy/ubyte.hpp +@@ -2,6 +2,36 @@ + #define PYTHONIC_NUMPY_UBYTE_HPP + + #include "pythonic/include/numpy/ubyte.hpp" +-#include "pythonic/numpy/uint8.hpp" ++ ++#include "pythonic/utils/functor.hpp" ++#include "pythonic/utils/meta.hpp" ++#include "pythonic/utils/numpy_traits.hpp" ++#include "pythonic/types/numpy_op_helper.hpp" ++ ++PYTHONIC_NS_BEGIN ++ ++namespace numpy ++{ ++ ++ namespace details ++ { ++ ++ unsigned char ubyte() ++ { ++ return {}; ++ } ++ ++ template ++ unsigned char ubyte(V v) ++ { ++ return v; ++ } ++ } ++ ++#define NUMPY_NARY_FUNC_NAME ubyte ++#define NUMPY_NARY_FUNC_SYM details::ubyte ++#include "pythonic/types/numpy_nary_expr.hpp" ++} ++PYTHONIC_NS_END + + #endif +diff --git a/pythran/pythonic/numpy/uint.hpp b/pythran/pythonic/numpy/uint.hpp +new file mode 100644 +index 000000000..b6592db88 +--- /dev/null ++++ b/pythran/pythonic/numpy/uint.hpp +@@ -0,0 +1,37 @@ ++#ifndef PYTHONIC_NUMPY_UINT_HPP ++#define PYTHONIC_NUMPY_UINT_HPP ++ ++#include "pythonic/include/numpy/uint.hpp" ++ ++#include "pythonic/utils/functor.hpp" ++#include "pythonic/utils/meta.hpp" ++#include "pythonic/utils/numpy_traits.hpp" ++#include "pythonic/types/numpy_op_helper.hpp" ++ ++PYTHONIC_NS_BEGIN ++ ++namespace numpy ++{ ++ ++ namespace details ++ { ++ ++ unsigned long uint() ++ { ++ return {}; ++ } ++ ++ template ++ unsigned long uint(V v) ++ { ++ return v; ++ } ++ } ++ ++#define NUMPY_NARY_FUNC_NAME uint ++#define NUMPY_NARY_FUNC_SYM details::uint ++#include "pythonic/types/numpy_nary_expr.hpp" ++} ++PYTHONIC_NS_END ++ ++#endif +diff --git a/pythran/pythonic/numpy/ulonglong.hpp b/pythran/pythonic/numpy/ulonglong.hpp +new file mode 100644 +index 000000000..2210ac475 +--- /dev/null ++++ b/pythran/pythonic/numpy/ulonglong.hpp +@@ -0,0 +1,37 @@ ++#ifndef PYTHONIC_NUMPY_ULONGLONG_HPP ++#define PYTHONIC_NUMPY_ULONGLONG_HPP ++ ++#include "pythonic/include/numpy/ulonglong.hpp" ++ ++#include "pythonic/utils/functor.hpp" ++#include "pythonic/utils/meta.hpp" ++#include "pythonic/utils/numpy_traits.hpp" ++#include "pythonic/types/numpy_op_helper.hpp" ++ ++PYTHONIC_NS_BEGIN ++ ++namespace numpy ++{ ++ ++ namespace details ++ { ++ ++ unsigned long long ulonglong() ++ { ++ return {}; ++ } ++ ++ template ++ unsigned long long ulonglong(V v) ++ { ++ return v; ++ } ++ } ++ ++#define NUMPY_NARY_FUNC_NAME ulonglong ++#define NUMPY_NARY_FUNC_SYM details::ulonglong ++#include "pythonic/types/numpy_nary_expr.hpp" ++} ++PYTHONIC_NS_END ++ ++#endif +diff --git a/pythran/pythonic/numpy/ushort.hpp b/pythran/pythonic/numpy/ushort.hpp +new file mode 100644 +index 000000000..0a700385c +--- /dev/null ++++ b/pythran/pythonic/numpy/ushort.hpp +@@ -0,0 +1,37 @@ ++#ifndef PYTHONIC_NUMPY_USHORT_HPP ++#define PYTHONIC_NUMPY_USHORT_HPP ++ ++#include "pythonic/include/numpy/ushort.hpp" ++ ++#include "pythonic/utils/functor.hpp" ++#include "pythonic/utils/meta.hpp" ++#include "pythonic/utils/numpy_traits.hpp" ++#include "pythonic/types/numpy_op_helper.hpp" ++ ++PYTHONIC_NS_BEGIN ++ ++namespace numpy ++{ ++ ++ namespace details ++ { ++ ++ unsigned short ushort() ++ { ++ return {}; ++ } ++ ++ template ++ unsigned short ushort(V v) ++ { ++ return v; ++ } ++ } ++ ++#define NUMPY_NARY_FUNC_NAME ushort ++#define NUMPY_NARY_FUNC_SYM details::ushort ++#include "pythonic/types/numpy_nary_expr.hpp" ++} ++PYTHONIC_NS_END ++ ++#endif +diff --git a/pythran/pythonic/types/int.hpp b/pythran/pythonic/types/int.hpp +index 96d66d733..b0a0fd6e1 100644 +--- a/pythran/pythonic/types/int.hpp ++++ b/pythran/pythonic/types/int.hpp +@@ -102,6 +102,10 @@ struct c_type_to_numpy_type + : std::integral_constant { + }; + ++template <> ++struct c_type_to_numpy_type : std::integral_constant { ++}; ++ + template <> + struct c_type_to_numpy_type + : std::integral_constant { +@@ -136,6 +140,7 @@ struct c_type_to_numpy_type : std::integral_constant { + nullptr); \ + } + ++PYTHONIC_INT_TO_PYTHON(char) + PYTHONIC_INT_TO_PYTHON(unsigned char) + PYTHONIC_INT_TO_PYTHON(signed char) + PYTHONIC_INT_TO_PYTHON(unsigned short) +diff --git a/pythran/tables.py b/pythran/tables.py +index 851b30782..4fbb38f3c 100644 +--- a/pythran/tables.py ++++ b/pythran/tables.py +@@ -3407,6 +3407,7 @@ def partialsum(seq): + ), + "bool": ConstFunctionIntr(signature=_bool_signature), + "broadcast_to": ConstFunctionIntr(), ++ "byte": ConstFunctionIntr(signature=_int_signature), + "cbrt": ConstFunctionIntr( + signature=_numpy_unary_op_float_signature + ), +@@ -3835,6 +3836,7 @@ def partialsum(seq): + BINARY_UFUNC, + signature=_numpy_int_binary_op_signature + ), ++ "longlong": ConstFunctionIntr(signature=_int_signature), + "max": ConstMethodIntr(signature=_numpy_unary_op_axis_signature), + "maximum": UFunc( + BINARY_UFUNC, +@@ -3993,6 +3995,7 @@ def partialsum(seq): + "select": ConstFunctionIntr(), + "setdiff1d": ConstFunctionIntr(), + "shape": ConstFunctionIntr(), ++ "short_": ConstFunctionIntr(signature=_int_signature), + "sign": ConstFunctionIntr(), + "signbit": ConstFunctionIntr(), + "sin": ConstFunctionIntr(signature=_numpy_unary_op_float_signature), +@@ -4012,6 +4015,7 @@ def partialsum(seq): + ), + "sum": ConstMethodIntr(signature=_numpy_unary_op_sum_axis_signature), + "swapaxes": ConstMethodIntr(), ++ "short": ConstFunctionIntr(signature=_int_signature), + "take": ConstMethodIntr(), + "tan": ConstFunctionIntr(signature=_numpy_unary_op_float_signature), + "tanh": ConstFunctionIntr(signature=_numpy_unary_op_float_signature), +@@ -4031,10 +4035,12 @@ def partialsum(seq): + "uintc": ConstFunctionIntr(signature=_int_signature), + "uintp": ConstFunctionIntr(signature=_int_signature), + "uint8": ConstFunctionIntr(signature=_int_signature), ++ "ulonglong": ConstFunctionIntr(signature=_int_signature), + "union1d": ConstFunctionIntr(), + "unique": ConstFunctionIntr(), + "unwrap": ConstFunctionIntr(), + "unravel_index": ConstFunctionIntr(), ++ "ushort": ConstFunctionIntr(signature=_int_signature), + "var": ConstMethodIntr(), + "vstack": ConstFunctionIntr(), + "stack": ConstFunctionIntr(), +diff --git a/pythran/tests/test_ndarray.py b/pythran/tests/test_ndarray.py +index 44577ff51..9461249c6 100644 +--- a/pythran/tests/test_ndarray.py ++++ b/pythran/tests/test_ndarray.py +@@ -703,6 +703,21 @@ def test_ndarray_ubyte(self): + 4, + ndarray_ubyte=[int]) + ++ def test_ndarray_byte(self): ++ self.run_test("def ndarray_byte(n): import numpy; return numpy.arange(-n, n, 1, dtype=numpy.byte)", ++ 4, ++ ndarray_byte=[int]) ++ ++ def test_ndarray_ushort(self): ++ self.run_test("def ndarray_ushort(n): import numpy; return numpy.arange(0, n, 1, dtype=numpy.ushort)", ++ 4, ++ ndarray_ushort=[int]) ++ ++ def test_ndarray_short(self): ++ self.run_test("def ndarray_short(n): import numpy; return numpy.arange(-n, n, 1, dtype=numpy.short)", ++ 4, ++ ndarray_short=[int]) ++ + def test_ndarray_1d_index(self): + self.run_test( + 'def ndarray_1d_index(a): return a[1], a[-1]', diff --git a/pythran.spec b/pythran.spec index f5e84c6..599a14b 100644 --- a/pythran.spec +++ b/pythran.spec @@ -14,6 +14,11 @@ Provides: bundled(libcxx) = 3 URL: https://github.com/serge-sans-paille/pythran Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz +# Pythran 0.9.4post1+ 32bit fix +# https://github.com/serge-sans-paille/pythran/pull/1419 +Patch1: %{url}/commit/b0501d3d6e11d00c8c839adcc2694820ecfa519e.patch +Patch2: %{url}/commit/2be7a91f3d2cf9a863afeb6aae5ca20c0ca2e2c3.patch + # there is no actual arched content # yet we want to test on all architectures # and we also might need to skip some