Skip to content

Commit 9743d06

Browse files
skirpichevencukouvstinner
authored
gh-128813: deprecate cval field of the PyComplexObject struct (#137271)
Co-authored-by: Petr Viktorin <encukou@gmail.com> Co-authored-by: Victor Stinner <vstinner@python.org>
1 parent fb1cb00 commit 9743d06

File tree

5 files changed

+29
-2
lines changed

5 files changed

+29
-2
lines changed

Doc/c-api/complex.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,16 @@ Complex Numbers as Python Objects
118118
119119
This subtype of :c:type:`PyObject` represents a Python complex number object.
120120
121+
.. c:member:: Py_complex cval
122+
123+
The complex number value, using the C :c:type:`Py_complex` representation.
124+
125+
.. deprecated-removed:: next 3.20
126+
Use :c:func:`PyComplex_AsCComplex` and
127+
:c:func:`PyComplex_FromCComplex` to convert a
128+
Python complex number to/from the C :c:type:`Py_complex`
129+
representation.
130+
121131
122132
.. c:var:: PyTypeObject PyComplex_Type
123133
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Pending removal in Python 3.20
2+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3+
4+
* The ``cval`` field in :c:type:`PyComplexObject` (:gh:`128813`).
5+
Use :c:func:`PyComplex_AsCComplex` and :c:func:`PyComplex_FromCComplex`
6+
to convert a Python complex number to/from the C :c:type:`Py_complex`
7+
representation.

Doc/deprecations/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,6 @@ C API deprecations
1818

1919
.. include:: c-api-pending-removal-in-3.18.rst
2020

21+
.. include:: c-api-pending-removal-in-3.20.rst
22+
2123
.. include:: c-api-pending-removal-in-future.rst

Doc/whatsnew/3.15.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,13 @@ Deprecated C APIs
570570
signed integer type of the same size is now deprecated.
571571
(Contributed by Serhiy Storchaka in :gh:`132629`.)
572572

573+
* Deprecate :c:member:`~PyComplexObject.cval` field of the the
574+
:c:type:`PyComplexObject` type.
575+
Use :c:func:`PyComplex_AsCComplex` and :c:func:`PyComplex_FromCComplex`
576+
to convert a Python complex number to/from the C :c:type:`Py_complex`
577+
representation.
578+
(Contributed by Sergey B Kirpichev in :gh:`128813`.)
579+
573580
* Functions :c:func:`_Py_c_sum`, :c:func:`_Py_c_diff`, :c:func:`_Py_c_neg`,
574581
:c:func:`_Py_c_prod`, :c:func:`_Py_c_quot`, :c:func:`_Py_c_pow` and
575582
:c:func:`_Py_c_abs` are :term:`soft deprecated`.
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
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`.
2+
:c:func:`_Py_c_prod`, :c:func:`_Py_c_quot`, :c:func:`_Py_c_pow` and previously
3+
undocumented :c:func:`_Py_c_abs` are :term:`soft deprecated`. Deprecate also
4+
:c:member:`~PyComplexObject.cval` field of the :c:type:`PyComplexObject` type.
45
Patch by Sergey B Kirpichev.

0 commit comments

Comments
 (0)