Skip to content

Commit 88953d5

Browse files
skirpichevvstinner
andauthored
pythongh-141004: Deprecate Py_MATH_El and Py_MATH_PIl macros (python#141035)
Co-authored-by: Victor Stinner <[email protected]>
1 parent 55ea132 commit 88953d5

File tree

5 files changed

+23
-0
lines changed

5 files changed

+23
-0
lines changed

Doc/c-api/float.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,20 @@ Floating-Point Objects
7878
Return the minimum normalized positive float *DBL_MIN* as C :c:expr:`double`.
7979
8080
81+
.. c:macro:: Py_MATH_El
82+
83+
High precision (long double) definition of :data:`~math.e` constant.
84+
85+
.. deprecated-removed:: 3.15 3.20
86+
87+
88+
.. c:macro:: Py_MATH_PIl
89+
90+
High precision (long double) definition of :data:`~math.pi` constant.
91+
92+
.. deprecated-removed:: 3.15 3.20
93+
94+
8195
.. c:macro:: Py_RETURN_NAN
8296
8397
Return :data:`math.nan` from a function.

Doc/deprecations/c-api-pending-removal-in-3.20.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ Pending removal in Python 3.20
55
Use :c:func:`PyComplex_AsCComplex` and :c:func:`PyComplex_FromCComplex`
66
to convert a Python complex number to/from the C :c:type:`Py_complex`
77
representation.
8+
9+
* Macros :c:macro:`!Py_MATH_PIl` and :c:macro:`!Py_MATH_El`.

Doc/whatsnew/3.15.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,6 +1076,10 @@ Deprecated C APIs
10761076
since 3.15 and will be removed in 3.17.
10771077
(Contributed by Nikita Sobolev in :gh:`136355`.)
10781078

1079+
* :c:macro:`!Py_MATH_El` and :c:macro:`!Py_MATH_PIl` are deprecated
1080+
since 3.15 and will be removed in 3.20.
1081+
(Contributed by Sergey B Kirpichev in :gh:`141004`.)
1082+
10791083

10801084
.. Add C API deprecations above alphabetically, not here at the end.
10811085

Include/pymath.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@
77
/* High precision definition of pi and e (Euler)
88
* The values are taken from libc6's math.h.
99
*/
10+
// Deprecated since Python 3.15.
1011
#ifndef Py_MATH_PIl
1112
#define Py_MATH_PIl 3.1415926535897932384626433832795029L
1213
#endif
1314
#ifndef Py_MATH_PI
1415
#define Py_MATH_PI 3.14159265358979323846
1516
#endif
1617

18+
// Deprecated since Python 3.15.
1719
#ifndef Py_MATH_El
1820
#define Py_MATH_El 2.7182818284590452353602874713526625L
1921
#endif
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
:c:macro:`!Py_MATH_El` and :c:macro:`!Py_MATH_PIl` are deprecated.

0 commit comments

Comments
 (0)