Skip to content

Commit 9ced5c4

Browse files
authored
gh-128813: soft-deprecate _Py_c_*() functions (GH-137261)
1 parent 2a87af0 commit 9ced5c4

File tree

4 files changed

+39
-1
lines changed

4 files changed

+39
-1
lines changed

Doc/c-api/complex.rst

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,24 +43,36 @@ pointers. This is consistent throughout the API.
4343
Return the sum of two complex numbers, using the C :c:type:`Py_complex`
4444
representation.
4545
46+
.. deprecated:: 3.15
47+
This function is :term:`soft deprecated`.
48+
4649
4750
.. c:function:: Py_complex _Py_c_diff(Py_complex left, Py_complex right)
4851
4952
Return the difference between two complex numbers, using the C
5053
:c:type:`Py_complex` representation.
5154
55+
.. deprecated:: 3.15
56+
This function is :term:`soft deprecated`.
57+
5258
5359
.. c:function:: Py_complex _Py_c_neg(Py_complex num)
5460
5561
Return the negation of the complex number *num*, using the C
5662
:c:type:`Py_complex` representation.
5763
64+
.. deprecated:: 3.15
65+
This function is :term:`soft deprecated`.
66+
5867
5968
.. c:function:: Py_complex _Py_c_prod(Py_complex left, Py_complex right)
6069
6170
Return the product of two complex numbers, using the C :c:type:`Py_complex`
6271
representation.
6372
73+
.. deprecated:: 3.15
74+
This function is :term:`soft deprecated`.
75+
6476
6577
.. c:function:: Py_complex _Py_c_quot(Py_complex dividend, Py_complex divisor)
6678
@@ -70,6 +82,9 @@ pointers. This is consistent throughout the API.
7082
If *divisor* is null, this method returns zero and sets
7183
:c:data:`errno` to :c:macro:`!EDOM`.
7284
85+
.. deprecated:: 3.15
86+
This function is :term:`soft deprecated`.
87+
7388
7489
.. c:function:: Py_complex _Py_c_pow(Py_complex num, Py_complex exp)
7590
@@ -81,6 +96,19 @@ pointers. This is consistent throughout the API.
8196
8297
Set :c:data:`errno` to :c:macro:`!ERANGE` on overflows.
8398
99+
.. deprecated:: 3.15
100+
This function is :term:`soft deprecated`.
101+
102+
103+
.. c:function:: double _Py_c_abs(Py_complex num)
104+
105+
Return the absolute value of the complex number *num*.
106+
107+
Set :c:data:`errno` to :c:macro:`!ERANGE` on overflows.
108+
109+
.. deprecated:: 3.15
110+
This function is :term:`soft deprecated`.
111+
84112
85113
Complex Numbers as Python Objects
86114
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Doc/whatsnew/3.15.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,11 @@ Deprecated C APIs
548548
signed integer type of the same size is now deprecated.
549549
(Contributed by Serhiy Storchaka in :gh:`132629`.)
550550

551+
* Functions :c:func:`_Py_c_sum`, :c:func:`_Py_c_diff`, :c:func:`_Py_c_neg`,
552+
:c:func:`_Py_c_prod`, :c:func:`_Py_c_quot`, :c:func:`_Py_c_pow` and
553+
:c:func:`_Py_c_abs` are :term:`soft deprecated`.
554+
(Contributed by Sergey B Kirpichev in :gh:`128813`.)
555+
551556
.. Add C API deprecations above alphabetically, not here at the end.
552557
553558
Removed C APIs

Include/cpython/complexobject.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ typedef struct {
77
double imag;
88
} Py_complex;
99

10-
// Operations on complex numbers.
10+
/* Operations on complex numbers (soft deprecated
11+
since Python 3.15). */
1112
PyAPI_FUNC(Py_complex) _Py_c_sum(Py_complex, Py_complex);
1213
PyAPI_FUNC(Py_complex) _Py_c_diff(Py_complex, Py_complex);
1314
PyAPI_FUNC(Py_complex) _Py_c_neg(Py_complex);
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Functions :c:func:`_Py_c_sum`, :c:func:`_Py_c_diff`, :c:func:`_Py_c_neg`,
2+
:c:func:`_Py_c_prod`, :c:func:`_Py_c_quot`, :c:func:`_Py_c_pow` and
3+
previously undocumented :c:func:`_Py_c_abs` are :term:`soft deprecated`.
4+
Patch by Sergey B Kirpichev.

0 commit comments

Comments
 (0)