Accepting request 1101065 from devel:languages:python:numeric
OBS-URL: https://build.opensuse.org/request/show/1101065 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-pythran?expand=0&rev=10
This commit is contained in:
commit
e6bd6c692a
39
numpy-complex.patch
Normal file
39
numpy-complex.patch
Normal file
@ -0,0 +1,39 @@
|
||||
From a49dc44076f7068205c22f532975c50cc4c03958 Mon Sep 17 00:00:00 2001
|
||||
From: Lysandros Nikolaou <lisandrosnik@gmail.com>
|
||||
Date: Wed, 19 Jul 2023 13:03:41 +0200
|
||||
Subject: [PATCH] Use npy_creal/npy_cimag from npy_math in from_python::convert
|
||||
|
||||
---
|
||||
pythran/pythonic/types/complex.hpp | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/pythran/pythonic/types/complex.hpp b/pythran/pythonic/types/complex.hpp
|
||||
index 9b57f7384..929a3d200 100644
|
||||
--- a/pythran/pythonic/types/complex.hpp
|
||||
+++ b/pythran/pythonic/types/complex.hpp
|
||||
@@ -177,6 +177,7 @@ PYTHONIC_NS_END
|
||||
#ifdef ENABLE_PYTHON_MODULE
|
||||
|
||||
#include "numpy/arrayscalars.h"
|
||||
+#include "numpy/npy_math.h"
|
||||
#include "pythonic/python/core.hpp"
|
||||
|
||||
PYTHONIC_NS_BEGIN
|
||||
@@ -228,7 +229,7 @@ inline std::complex<long double>
|
||||
from_python<std::complex<long double>>::convert(PyObject *obj)
|
||||
{
|
||||
auto val = PyArrayScalar_VAL(obj, CLongDouble);
|
||||
- return {val.real, val.imag};
|
||||
+ return {npy_creall(val), npy_cimagl(val)};
|
||||
}
|
||||
|
||||
template <>
|
||||
@@ -243,7 +244,7 @@ inline std::complex<float>
|
||||
from_python<std::complex<float>>::convert(PyObject *obj)
|
||||
{
|
||||
auto val = PyArrayScalar_VAL(obj, CFloat);
|
||||
- return {val.real, val.imag};
|
||||
+ return {npy_crealf(val), npy_cimagf(val)};
|
||||
}
|
||||
PYTHONIC_NS_END
|
||||
#endif
|
122
numpy-longdouble.patch
Normal file
122
numpy-longdouble.patch
Normal file
@ -0,0 +1,122 @@
|
||||
From 339fb5dcdf28f40311b5051925fd8a2c86286ac6 Mon Sep 17 00:00:00 2001
|
||||
From: serge-sans-paille <serge.guelton@telecom-bretagne.eu>
|
||||
Date: Thu, 6 Jul 2023 22:06:20 +0200
|
||||
Subject: [PATCH] Introduce pythran/pythonic/include/types/longdouble.hpp et
|
||||
cie
|
||||
|
||||
New numpy version alias np.float128 to np.longdouble, so we need these
|
||||
headers too. Same for np.complex256 and np.clongdouble.
|
||||
|
||||
SLightly adjust notebook tests for portability to that respect.
|
||||
---
|
||||
pythran/pythonic/include/types/clongdouble.hpp | 6 ++++++
|
||||
pythran/pythonic/include/types/longdouble.hpp | 4 ++++
|
||||
pythran/pythonic/types/clongdouble.hpp | 7 +++++++
|
||||
pythran/pythonic/types/float128.hpp | 2 +-
|
||||
pythran/pythonic/types/longdouble.hpp | 6 ++++++
|
||||
pythran/tests/notebooks/export.ipynb | 14 +++++++-------
|
||||
6 files changed, 31 insertions(+), 8 deletions(-)
|
||||
create mode 100644 pythran/pythonic/include/types/clongdouble.hpp
|
||||
create mode 100644 pythran/pythonic/include/types/longdouble.hpp
|
||||
create mode 100644 pythran/pythonic/types/clongdouble.hpp
|
||||
create mode 100644 pythran/pythonic/types/longdouble.hpp
|
||||
|
||||
diff --git a/pythran/pythonic/include/types/clongdouble.hpp b/pythran/pythonic/include/types/clongdouble.hpp
|
||||
new file mode 100644
|
||||
index 0000000000..dd666a52f5
|
||||
--- /dev/null
|
||||
+++ b/pythran/pythonic/include/types/clongdouble.hpp
|
||||
@@ -0,0 +1,6 @@
|
||||
+#ifndef PYTHONIC_INCLUDE_TYPES_CLONGDOUBLE_HPP
|
||||
+#define PYTHONIC_INCLUDE_TYPES_CLONGDOUBLE_HPP
|
||||
+
|
||||
+#include "pythonic/include/types/complex.hpp"
|
||||
+
|
||||
+#endif
|
||||
diff --git a/pythran/pythonic/include/types/longdouble.hpp b/pythran/pythonic/include/types/longdouble.hpp
|
||||
new file mode 100644
|
||||
index 0000000000..1ee2fca96c
|
||||
--- /dev/null
|
||||
+++ b/pythran/pythonic/include/types/longdouble.hpp
|
||||
@@ -0,0 +1,4 @@
|
||||
+#ifndef PYTHONIC_INCLUDE_TYPES_LONGDOUBLE_HPP
|
||||
+#define PYTHONIC_INCLUDE_TYPES_LONGDOUBLE_HPP
|
||||
+
|
||||
+#endif
|
||||
diff --git a/pythran/pythonic/types/clongdouble.hpp b/pythran/pythonic/types/clongdouble.hpp
|
||||
new file mode 100644
|
||||
index 0000000000..057a2b9cb6
|
||||
--- /dev/null
|
||||
+++ b/pythran/pythonic/types/clongdouble.hpp
|
||||
@@ -0,0 +1,7 @@
|
||||
+#ifndef PYTHONIC_TYPES_CLONGDOUBLE_HPP
|
||||
+#define PYTHONIC_TYPES_CLONGDOUBLE_HPP
|
||||
+
|
||||
+#include "pythonic/include/types/clongdouble.hpp"
|
||||
+#include "pythonic/types/complex.hpp"
|
||||
+
|
||||
+#endif
|
||||
diff --git a/pythran/pythonic/types/float128.hpp b/pythran/pythonic/types/float128.hpp
|
||||
index bf67552447..0943827ff3 100644
|
||||
--- a/pythran/pythonic/types/float128.hpp
|
||||
+++ b/pythran/pythonic/types/float128.hpp
|
||||
@@ -1,6 +1,6 @@
|
||||
#ifndef PYTHONIC_TYPES_FLOAT128_HPP
|
||||
#define PYTHONIC_TYPES_FLOAT128_HPP
|
||||
|
||||
-#include "pythonic/include/types/float64.hpp"
|
||||
+#include "pythonic/include/types/float128.hpp"
|
||||
|
||||
#endif
|
||||
diff --git a/pythran/pythonic/types/longdouble.hpp b/pythran/pythonic/types/longdouble.hpp
|
||||
new file mode 100644
|
||||
index 0000000000..b3944cea6a
|
||||
--- /dev/null
|
||||
+++ b/pythran/pythonic/types/longdouble.hpp
|
||||
@@ -0,0 +1,6 @@
|
||||
+#ifndef PYTHONIC_TYPES_LONGDOUBLE_HPP
|
||||
+#define PYTHONIC_TYPES_LONGDOUBLE_HPP
|
||||
+
|
||||
+#include "pythonic/include/types/longdouble.hpp"
|
||||
+
|
||||
+#endif
|
||||
diff --git a/pythran/tests/notebooks/export.ipynb b/pythran/tests/notebooks/export.ipynb
|
||||
index aa2baadc06..3f390dc0f1 100644
|
||||
--- a/pythran/tests/notebooks/export.ipynb
|
||||
+++ b/pythran/tests/notebooks/export.ipynb
|
||||
@@ -418,20 +418,20 @@
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
- "(1.5, -1.5) <class 'numpy.float32'>\n",
|
||||
- "(1.5, -1.5) <class 'float'>\n",
|
||||
- "(1.5, -1.5) <class 'numpy.float128'>\n"
|
||||
+ "(1.5, -1.5)\n",
|
||||
+ "(1.5, -1.5)\n",
|
||||
+ "(1.5, -1.5)\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import numpy as np\n",
|
||||
"x64 = dtype(np.complex64(1.5 + -1.5j))\n",
|
||||
- "print(x64, type(x64[0]))\n",
|
||||
+ "print(x64)\n",
|
||||
"x128 = dtype(np.complex128(1.5 + -1.5j))\n",
|
||||
- "print(x128, type(x128[0]))\n",
|
||||
+ "print(x128)\n",
|
||||
"x256 = dtype(np.complex256(1.5 + -1.5j))\n",
|
||||
- "print(x256, type(x256[0]))"
|
||||
+ "print(x256)"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -969,7 +969,7 @@
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
- "version": "3.10.9"
|
||||
+ "version": "3.10.11"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
@ -1,3 +1,8 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Jul 27 10:10:55 UTC 2023 - Markéta Machová <mmachova@suse.com>
|
||||
|
||||
- Add upstream numpy-longdouble.patch and numpy-complex.patch to support new numpy
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sat Jun 10 17:53:22 UTC 2023 - ecsos <ecsos@opensuse.org>
|
||||
|
||||
|
@ -52,6 +52,10 @@ URL: https://github.com/serge-sans-paille/pythran
|
||||
# Tests are only availble in github archive
|
||||
Source0: https://github.com/serge-sans-paille/pythran/archive/refs/tags/%{version}.tar.gz#/pythran-%{version}-gh.tar.gz
|
||||
Source99: python-pythran-rpmlintrc
|
||||
#PATCH-FIX-UPSTREAM https://github.com/serge-sans-paille/pythran/commit/339fb5dcdf28f40311b5051925fd8a2c86286ac6 Introduce pythran/pythonic/include/types/longdouble.hpp et cie
|
||||
Patch: numpy-longdouble.patch
|
||||
#PATCH-FIX-UPSTREAM https://github.com/serge-sans-paille/pythran/commit/a49dc44076f7068205c22f532975c50cc4c03958 Use npy_creal/npy_cimag from npy_math in from_python::convert
|
||||
Patch: numpy-complex.patch
|
||||
BuildRequires: %{python_module setuptools}
|
||||
BuildRequires: fdupes
|
||||
BuildRequires: python-rpm-macros
|
||||
|
Loading…
Reference in New Issue
Block a user