https://github.com/python/cpython/commit/f2402cba9dcbd78a267e60d65bbf40595dc78b3a
commit: f2402cba9dcbd78a267e60d65bbf40595dc78b3a
branch: 3.15
author: Victor Stinner <[email protected]>
committer: vstinner <[email protected]>
date: 2026-06-26T16:26:52+02:00
summary:

[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 5f17434a1ec9a121eb38f71dc3d5809020b5fbb4)

Co-authored-by: Sergey B Kirpichev <[email protected]>

files:
M Doc/deprecations/soft-deprecations.rst
M Doc/library/struct.rst
M Doc/whatsnew/3.15.rst

diff --git a/Doc/deprecations/soft-deprecations.rst 
b/Doc/deprecations/soft-deprecations.rst
index a270052788ef2a1..d1dd2b2d8c520d6 100644
--- a/Doc/deprecations/soft-deprecations.rst
+++ b/Doc/deprecations/soft-deprecations.rst
@@ -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`.)
diff --git a/Doc/library/struct.rst b/Doc/library/struct.rst
index 05662c6c2d898d7..ef535e3ca6e8820 100644
--- a/Doc/library/struct.rst
+++ b/Doc/library/struct.rst
@@ -260,10 +260,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)      |
@@ -286,6 +282,7 @@ platform-dependent.
 
 .. versionchanged:: 3.15
    Added support for the ``'Zf'`` and ``'Zd'`` formats.
+   ``'F'`` and ``'D'`` formats are :term:`soft deprecated`.
 
 .. seealso::
 
@@ -376,13 +373,15 @@ Notes:
    are accepted.
 
 (10)
-   For the ``'F'`` and ``'D'`` format characters, 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 format character may be preceded by an integral repeat count.  For example,
diff --git a/Doc/whatsnew/3.15.rst b/Doc/whatsnew/3.15.rst
index 88b238c709dd0e3..bad9e2d8dff37f6 100644
--- a/Doc/whatsnew/3.15.rst
+++ b/Doc/whatsnew/3.15.rst
@@ -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

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to