python-pythran/numpy-longdouble.patch

123 lines
4.0 KiB
Diff

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,