Skip to content

Commit 5f17434

Browse files
skirpichevvstinner
andauthored
gh-121249: Soft deprecate F and D struct format types (#149346)
Remove F/D type codes from table in the struct module documentation. Co-authored-by: Victor Stinner <vstinner@python.org>
1 parent 05679f3 commit 5f17434

3 files changed

Lines changed: 15 additions & 6 deletions

File tree

Doc/deprecations/soft-deprecations.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,8 @@ There are no plans to remove :term:`soft deprecated` APIs.
1919

2020
(Contributed by Gregory P. Smith in :gh:`86519` and
2121
Hugo van Kemenade in :gh:`148100`.)
22+
23+
* Using ``'F'`` and ``'D'`` format type codes of the :mod:`struct` module
24+
now are :term:`soft deprecated` in favor of two-letter forms ``'Zf'``
25+
and ``'Zd'``.
26+
(Contributed by Sergey B Kirpichev in :gh:`121249`.)

Doc/library/struct.rst

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -261,10 +261,6 @@ platform-dependent.
261261
+--------+--------------------------+--------------------+----------------+------------+
262262
| ``d`` | :c:expr:`double` | float | 8 | \(4) |
263263
+--------+--------------------------+--------------------+----------------+------------+
264-
| ``F`` | :c:expr:`float complex` | complex | 8 | \(10) |
265-
+--------+--------------------------+--------------------+----------------+------------+
266-
| ``D`` | :c:expr:`double complex` | complex | 16 | \(10) |
267-
+--------+--------------------------+--------------------+----------------+------------+
268264
| ``Zf`` | :c:expr:`float complex` | complex | 8 | \(10) |
269265
+--------+--------------------------+--------------------+----------------+------------+
270266
| ``Zd`` | :c:expr:`double complex` | complex | 16 | \(10) |
@@ -287,6 +283,7 @@ platform-dependent.
287283

288284
.. versionchanged:: 3.15
289285
Added support for the ``'Zf'`` and ``'Zd'`` formats.
286+
``'F'`` and ``'D'`` formats are :term:`soft deprecated`.
290287

291288
.. seealso::
292289

@@ -377,13 +374,15 @@ Notes:
377374
are accepted.
378375

379376
(10)
380-
For the ``'F'`` and ``'D'`` type codes, the packed representation uses
377+
For the ``'Zf'`` and ``'Zd'`` type codes, the packed representation uses
381378
the IEEE 754 binary32 and binary64 format for components of the complex
382379
number, regardless of the floating-point format used by the platform.
383-
Note that complex types (``F``/``Zf`` and ``D``/``Zd``) are available unconditionally,
380+
Note that complex types are available unconditionally,
384381
despite complex types being an optional feature in C.
385382
As specified in the C11 standard, each complex type is represented by a
386383
two-element C array containing, respectively, the real and imaginary parts.
384+
The ``'F'`` and ``'D'`` (for ``'Zf'`` and ``'Zd'``, respectively) format
385+
characters are supported for compatibility.
387386

388387

389388
A type code may be preceded by an integral repeat count. For example,

Doc/whatsnew/3.15.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2280,6 +2280,11 @@ New deprecations
22802280

22812281
(Contributed by Sergey B Kirpichev and Serhiy Storchaka in :gh:`143715`.)
22822282

2283+
* Using ``'F'`` and ``'D'`` type codes now are :term:`soft deprecated`
2284+
in favor of two-letter forms ``'Zf'`` and ``'Zd'``.
2285+
(Contributed by Sergey B Kirpichev in :gh:`121249`.)
2286+
2287+
22832288
* :mod:`typing`:
22842289

22852290
* The following statements now cause ``DeprecationWarning``\ s to be emitted

0 commit comments

Comments
 (0)