Skip to content

Commit 7cb20b1

Browse files
committed
gh-128813: deprecate cval field of the PyComplexObject struct
1 parent 09e0caf commit 7cb20b1

File tree

6 files changed

+19
-1
lines changed

6 files changed

+19
-1
lines changed

Doc/c-api/complex.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,12 @@ 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:: 3.15
126+
121127
122128
.. c:var:: PyTypeObject PyComplex_Type
123129
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Pending removal in Python 3.17
2+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3+
4+
* The ``cval`` field in :c:type:`PyComplexObject` (:gh:`128813`).

Doc/deprecations/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ C API deprecations
1616

1717
.. include:: c-api-pending-removal-in-3.15.rst
1818

19+
.. include:: c-api-pending-removal-in-3.17.rst
20+
1921
.. include:: c-api-pending-removal-in-3.18.rst
2022

2123
.. include:: c-api-pending-removal-in-future.rst

Doc/whatsnew/3.15.rst

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

551+
* Deprecate :c:member:`~PyComplexObject.cval` field of the the
552+
:c:type:`PyComplexObject` type.
553+
(Contributed by Sergey B Kirpichev in :gh:`128813`.)
554+
551555
* Functions :c:func:`_Py_c_sum`, :c:func:`_Py_c_diff`, :c:func:`_Py_c_neg`,
552556
:c:func:`_Py_c_prod`, :c:func:`_Py_c_quot`, :c:func:`_Py_c_pow` and
553557
:c:func:`_Py_c_abs` are :term:`soft deprecated`.

Include/cpython/complexobject.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ real and imaginary parts.
2626
*/
2727
typedef struct {
2828
PyObject_HEAD
29-
Py_complex cval;
29+
Py_DEPRECATED(3.15) Py_complex cval;
3030
} PyComplexObject;
3131

3232
PyAPI_FUNC(PyObject *) PyComplex_FromCComplex(Py_complex);
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Document and deprecate :c:member:`~PyComplexObject.cval` field of
2+
the :c:type:`PyComplexObject` type. Patch by Sergey B Kirpichev.

0 commit comments

Comments
 (0)