]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-128813: soft-deprecate _Py_c_*() functions (GH-137261)
authorSergey B Kirpichev <skirpichev@gmail.com>
Fri, 1 Aug 2025 07:40:12 +0000 (10:40 +0300)
committerGitHub <noreply@github.com>
Fri, 1 Aug 2025 07:40:12 +0000 (09:40 +0200)
Doc/c-api/complex.rst
Doc/whatsnew/3.15.rst
Include/cpython/complexobject.h
Misc/NEWS.d/next/C_API/2025-07-31-04-30-42.gh-issue-128813.opL-Pv.rst [new file with mode: 0644]

index 16bd79475dc1e66ea6fffd3ef3844dd3f1ce1f43..34488848f87cd1a9440408360ae8a742c9816548 100644 (file)
@@ -43,24 +43,36 @@ pointers.  This is consistent throughout the API.
    Return the sum of two complex numbers, using the C :c:type:`Py_complex`
    representation.
 
+   .. deprecated:: 3.15
+      This function is :term:`soft deprecated`.
+
 
 .. c:function:: Py_complex _Py_c_diff(Py_complex left, Py_complex right)
 
    Return the difference between two complex numbers, using the C
    :c:type:`Py_complex` representation.
 
+   .. deprecated:: 3.15
+      This function is :term:`soft deprecated`.
+
 
 .. c:function:: Py_complex _Py_c_neg(Py_complex num)
 
    Return the negation of the complex number *num*, using the C
    :c:type:`Py_complex` representation.
 
+   .. deprecated:: 3.15
+      This function is :term:`soft deprecated`.
+
 
 .. c:function:: Py_complex _Py_c_prod(Py_complex left, Py_complex right)
 
    Return the product of two complex numbers, using the C :c:type:`Py_complex`
    representation.
 
+   .. deprecated:: 3.15
+      This function is :term:`soft deprecated`.
+
 
 .. c:function:: Py_complex _Py_c_quot(Py_complex dividend, Py_complex divisor)
 
@@ -70,6 +82,9 @@ pointers.  This is consistent throughout the API.
    If *divisor* is null, this method returns zero and sets
    :c:data:`errno` to :c:macro:`!EDOM`.
 
+   .. deprecated:: 3.15
+      This function is :term:`soft deprecated`.
+
 
 .. c:function:: Py_complex _Py_c_pow(Py_complex num, Py_complex exp)
 
@@ -81,6 +96,19 @@ pointers.  This is consistent throughout the API.
 
    Set :c:data:`errno` to :c:macro:`!ERANGE` on overflows.
 
+   .. deprecated:: 3.15
+      This function is :term:`soft deprecated`.
+
+
+.. c:function:: double _Py_c_abs(Py_complex num)
+
+   Return the absolute value of the complex number *num*.
+
+   Set :c:data:`errno` to :c:macro:`!ERANGE` on overflows.
+
+   .. deprecated:: 3.15
+      This function is :term:`soft deprecated`.
+
 
 Complex Numbers as Python Objects
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
index 6c00a0fcb83fee5d687d509019ac2ac5cba1af78..1e54a61a449adccfbcc877c06d320ce233920697 100644 (file)
@@ -548,6 +548,11 @@ Deprecated C APIs
   signed integer type of the same size is now deprecated.
   (Contributed by Serhiy Storchaka in :gh:`132629`.)
 
+* Functions :c:func:`_Py_c_sum`, :c:func:`_Py_c_diff`, :c:func:`_Py_c_neg`,
+  :c:func:`_Py_c_prod`, :c:func:`_Py_c_quot`, :c:func:`_Py_c_pow` and
+  :c:func:`_Py_c_abs` are :term:`soft deprecated`.
+  (Contributed by Sergey B Kirpichev in :gh:`128813`.)
+
 .. Add C API deprecations above alphabetically, not here at the end.
 
 Removed C APIs
index fbdc6a91fe895c0f7af0bff6a3836a1991709c20..58da80140dc4c99a5c526fac13ad1a4cefb9780a 100644 (file)
@@ -7,7 +7,8 @@ typedef struct {
     double imag;
 } Py_complex;
 
-// Operations on complex numbers.
+/* Operations on complex numbers (soft deprecated
+   since Python 3.15). */
 PyAPI_FUNC(Py_complex) _Py_c_sum(Py_complex, Py_complex);
 PyAPI_FUNC(Py_complex) _Py_c_diff(Py_complex, Py_complex);
 PyAPI_FUNC(Py_complex) _Py_c_neg(Py_complex);
diff --git a/Misc/NEWS.d/next/C_API/2025-07-31-04-30-42.gh-issue-128813.opL-Pv.rst b/Misc/NEWS.d/next/C_API/2025-07-31-04-30-42.gh-issue-128813.opL-Pv.rst
new file mode 100644 (file)
index 0000000..625989b
--- /dev/null
@@ -0,0 +1,4 @@
+Functions :c:func:`_Py_c_sum`, :c:func:`_Py_c_diff`, :c:func:`_Py_c_neg`,
+:c:func:`_Py_c_prod`, :c:func:`_Py_c_quot`, :c:func:`_Py_c_pow` and
+previously undocumented :c:func:`_Py_c_abs` are :term:`soft deprecated`.
+Patch by Sergey B Kirpichev.