Skip to content

Commit f2402cb

Browse files
vstinnerskirpichev
andauthored
[3.15] gh-121249: Soft deprecate F and D struct format types (#149346) (#152274)
gh-121249: Soft deprecate F and D struct format types (#149346) Remove F/D type codes from table in the struct module documentation. (cherry picked from commit 5f17434) Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
1 parent f3e6bda commit f2402cb

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
@@ -260,10 +260,6 @@ platform-dependent.
260260
+--------+--------------------------+--------------------+----------------+------------+
261261
| ``d`` | :c:expr:`double` | float | 8 | \(4) |
262262
+--------+--------------------------+--------------------+----------------+------------+
263-
| ``F`` | :c:expr:`float complex` | complex | 8 | \(10) |
264-
+--------+--------------------------+--------------------+----------------+------------+
265-
| ``D`` | :c:expr:`double complex` | complex | 16 | \(10) |
266-
+--------+--------------------------+--------------------+----------------+------------+
267263
| ``Zf`` | :c:expr:`float complex` | complex | 8 | \(10) |
268264
+--------+--------------------------+--------------------+----------------+------------+
269265
| ``Zd`` | :c:expr:`double complex` | complex | 16 | \(10) |
@@ -286,6 +282,7 @@ platform-dependent.
286282

287283
.. versionchanged:: 3.15
288284
Added support for the ``'Zf'`` and ``'Zd'`` formats.
285+
``'F'`` and ``'D'`` formats are :term:`soft deprecated`.
289286

290287
.. seealso::
291288

@@ -376,13 +373,15 @@ Notes:
376373
are accepted.
377374

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

387386

388387
A format character 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)