]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-141004: Deprecate Py_MATH_El and Py_MATH_PIl macros (#141035)
authorSergey B Kirpichev <skirpichev@gmail.com>
Mon, 10 Nov 2025 15:36:01 +0000 (18:36 +0300)
committerGitHub <noreply@github.com>
Mon, 10 Nov 2025 15:36:01 +0000 (16:36 +0100)
Co-authored-by: Victor Stinner <vstinner@python.org>
Doc/c-api/float.rst
Doc/deprecations/c-api-pending-removal-in-3.20.rst
Doc/whatsnew/3.15.rst
Include/pymath.h
Misc/NEWS.d/next/C_API/2025-11-05-05-45-49.gh-issue-141004.N9Ooh9.rst [new file with mode: 0644]

index edee498a0b80f3920f024d0405680c514c056660..9e703a46445dce8b3483a396e9d5ca6fec1f203d 100644 (file)
@@ -78,6 +78,20 @@ Floating-Point Objects
    Return the minimum normalized positive float *DBL_MIN* as C :c:expr:`double`.
 
 
+.. c:macro:: Py_MATH_El
+
+   High precision (long double) definition of :data:`~math.e` constant.
+
+   .. deprecated-removed:: 3.15 3.20
+
+
+.. c:macro:: Py_MATH_PIl
+
+   High precision (long double) definition of :data:`~math.pi` constant.
+
+   .. deprecated-removed:: 3.15 3.20
+
+
 .. c:macro:: Py_RETURN_NAN
 
    Return :data:`math.nan` from a function.
index 82f975d6ed4020481f26ca94137eda229ac113c6..18623b19a2ab8da7988e62b012d52fddc1e5d8f1 100644 (file)
@@ -5,3 +5,5 @@ Pending removal in Python 3.20
   Use :c:func:`PyComplex_AsCComplex` and :c:func:`PyComplex_FromCComplex`
   to convert a Python complex number to/from the C :c:type:`Py_complex`
   representation.
+
+* Macros :c:macro:`!Py_MATH_PIl` and :c:macro:`!Py_MATH_El`.
index e0b0471567cf33238a2184ec336fef121d9ceae9..1ba394a19674039133ef32942c2d05722cbdf102 100644 (file)
@@ -1076,6 +1076,10 @@ Deprecated C APIs
   since 3.15 and will be removed in 3.17.
   (Contributed by Nikita Sobolev in :gh:`136355`.)
 
+* :c:macro:`!Py_MATH_El` and :c:macro:`!Py_MATH_PIl` are deprecated
+  since 3.15 and will be removed in 3.20.
+  (Contributed by Sergey B Kirpichev in :gh:`141004`.)
+
 
 .. Add C API deprecations above alphabetically, not here at the end.
 
index e2919c7b527267d9c13812206a6d4c009daedbc6..0f9f0f3b2990fe59af737b6edfbc845a486f4f08 100644 (file)
@@ -7,6 +7,7 @@
 /* High precision definition of pi and e (Euler)
  * The values are taken from libc6's math.h.
  */
+// Deprecated since Python 3.15.
 #ifndef Py_MATH_PIl
 #define Py_MATH_PIl 3.1415926535897932384626433832795029L
 #endif
@@ -14,6 +15,7 @@
 #define Py_MATH_PI 3.14159265358979323846
 #endif
 
+// Deprecated since Python 3.15.
 #ifndef Py_MATH_El
 #define Py_MATH_El 2.7182818284590452353602874713526625L
 #endif
diff --git a/Misc/NEWS.d/next/C_API/2025-11-05-05-45-49.gh-issue-141004.N9Ooh9.rst b/Misc/NEWS.d/next/C_API/2025-11-05-05-45-49.gh-issue-141004.N9Ooh9.rst
new file mode 100644 (file)
index 0000000..5f3ccd6
--- /dev/null
@@ -0,0 +1 @@
+:c:macro:`!Py_MATH_El` and :c:macro:`!Py_MATH_PIl` are deprecated.