]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-121249: Soft deprecate F and D struct format types (#149346)
authorSergey B Kirpichev <skirpichev@gmail.com>
Fri, 26 Jun 2026 13:03:49 +0000 (16:03 +0300)
committerGitHub <noreply@github.com>
Fri, 26 Jun 2026 13:03:49 +0000 (15:03 +0200)
Remove F/D type codes from table in the struct module documentation.

Co-authored-by: Victor Stinner <vstinner@python.org>
Doc/deprecations/soft-deprecations.rst
Doc/library/struct.rst
Doc/whatsnew/3.15.rst

index a270052788ef2a1082d1dda6734f5ae698279952..d1dd2b2d8c520d6df08e7ee65209b35005637d72 100644 (file)
@@ -19,3 +19,8 @@ There are no plans to remove :term:`soft deprecated` APIs.
 
   (Contributed by Gregory P. Smith in :gh:`86519` and
   Hugo van Kemenade in :gh:`148100`.)
+
+* Using ``'F'`` and ``'D'`` format type codes of the :mod:`struct` module
+  now are :term:`soft deprecated` in favor of two-letter forms ``'Zf'``
+  and ``'Zd'``.
+  (Contributed by Sergey B Kirpichev in :gh:`121249`.)
index ec872fddee05c703f6296c13db16f9a0d5a77231..775e5b2074851b7a6e0c8a2becab3aa4b550ea36 100644 (file)
@@ -261,10 +261,6 @@ platform-dependent.
 +--------+--------------------------+--------------------+----------------+------------+
 | ``d``  | :c:expr:`double`         | float              | 8              | \(4)       |
 +--------+--------------------------+--------------------+----------------+------------+
-| ``F``  | :c:expr:`float complex`  | complex            | 8              | \(10)      |
-+--------+--------------------------+--------------------+----------------+------------+
-| ``D``  | :c:expr:`double complex` | complex            | 16             | \(10)      |
-+--------+--------------------------+--------------------+----------------+------------+
 | ``Zf`` | :c:expr:`float complex`  | complex            | 8              | \(10)      |
 +--------+--------------------------+--------------------+----------------+------------+
 | ``Zd`` | :c:expr:`double complex` | complex            | 16             | \(10)      |
@@ -287,6 +283,7 @@ platform-dependent.
 
 .. versionchanged:: 3.15
    Added support for the ``'Zf'`` and ``'Zd'`` formats.
+   ``'F'`` and ``'D'`` formats are :term:`soft deprecated`.
 
 .. seealso::
 
@@ -377,13 +374,15 @@ Notes:
    are accepted.
 
 (10)
-   For the ``'F'`` and ``'D'`` type codes, the packed representation uses
+   For the ``'Zf'`` and ``'Zd'`` type codes, the packed representation uses
    the IEEE 754 binary32 and binary64 format for components of the complex
    number, regardless of the floating-point format used by the platform.
-   Note that complex types (``F``/``Zf`` and ``D``/``Zd``) are available unconditionally,
+   Note that complex types are available unconditionally,
    despite complex types being an optional feature in C.
    As specified in the C11 standard, each complex type is represented by a
    two-element C array containing, respectively, the real and imaginary parts.
+   The ``'F'`` and ``'D'`` (for ``'Zf'`` and ``'Zd'``, respectively) format
+   characters are supported for compatibility.
 
 
 A type code may be preceded by an integral repeat count.  For example,
index db6903da9f63444d673ba87a048b5f10dfb63611..a90f986b7354c151c8230f29ede1b6f74af16375 100644 (file)
@@ -2280,6 +2280,11 @@ New deprecations
 
     (Contributed by Sergey B Kirpichev and Serhiy Storchaka in :gh:`143715`.)
 
+  * Using ``'F'`` and ``'D'`` type codes now are :term:`soft deprecated`
+    in favor of two-letter forms ``'Zf'`` and ``'Zd'``.
+    (Contributed by Sergey B Kirpichev in :gh:`121249`.)
+
+
 * :mod:`typing`:
 
   * The following statements now cause ``DeprecationWarning``\ s to be emitted