diff --git a/Doc/deprecations/pending-removal-in-3.17.rst b/Doc/deprecations/pending-removal-in-3.17.rst index 952ffad64356d9..f4e9ede50457f2 100644 --- a/Doc/deprecations/pending-removal-in-3.17.rst +++ b/Doc/deprecations/pending-removal-in-3.17.rst @@ -37,6 +37,7 @@ Pending removal in Python 3.17 is deprecated and scheduled for removal in Python 3.17. (Contributed by Stan Ulbrych in :gh:`136702`.) + * :mod:`typing`: - Before Python 3.14, old-style unions were implemented using the private class diff --git a/Doc/deprecations/pending-removal-in-3.20.rst b/Doc/deprecations/pending-removal-in-3.20.rst index 011565dfbb090d..7fa7168693b750 100644 --- a/Doc/deprecations/pending-removal-in-3.20.rst +++ b/Doc/deprecations/pending-removal-in-3.20.rst @@ -1,12 +1,18 @@ Pending removal in Python 3.20 ------------------------------ -* Calling the ``__new__()`` method of :class:`struct.Struct` without the - *format* argument is deprecated and will be removed in Python 3.20. Calling - :meth:`~object.__init__` method on initialized :class:`~struct.Struct` - objects is deprecated and will be removed in Python 3.20. +* :mod:`struct`: + + - Calling the ``__new__()`` method of :class:`struct.Struct` without the + *format* argument is deprecated and will be removed in Python 3.20. Calling + :meth:`~object.__init__` method on initialized :class:`~struct.Struct` + objects is deprecated and will be removed in Python 3.20. + (Contributed by Sergey B Kirpichev and Serhiy Storchaka in :gh:`143715`.) + + - Support for ``'F'`` and ``'D'`` format type codes (the :c:expr:`float + complex` and :c:expr:`double complex` C types, respectively) + (Contributed by Sergey B Kirpichev in :gh:`121249`.) - (Contributed by Sergey B Kirpichev and Serhiy Storchaka in :gh:`143715`.) * The ``__version__``, ``version`` and ``VERSION`` attributes have been deprecated in these standard library modules and will be removed in diff --git a/Doc/library/struct.rst b/Doc/library/struct.rst index bf5f754e156d3c..ed591cf300518f 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) | @@ -287,6 +283,9 @@ platform-dependent. .. versionchanged:: next Added support for the ``'Zf'`` and ``'Zd'`` formats. +.. deprecated-removed:: 3.15 3.20 + Support for the ``'F'`` and ``'D'`` format codes. + .. seealso:: The :mod:`array` and :ref:`ctypes ` modules, @@ -376,13 +375,15 @@ Notes: are accepted. (10) - For the ``'F'`` and ``'D'`` format characters, the packed representation uses + For the ``'Zf'`` and ``'Zd'`` format characters, 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 e98c483baec823..c42491d6d74d8b 100644 --- a/Doc/whatsnew/3.15.rst +++ b/Doc/whatsnew/3.15.rst @@ -2054,6 +2054,11 @@ New deprecations (Contributed by Sergey B Kirpichev and Serhiy Storchaka in :gh:`143715`.) + - Support for ``'F'`` and ``'D'`` format type codes (the :c:expr:`float + complex` and :c:expr:`double complex` C types, respectively) + (Contributed by Sergey B Kirpichev in :gh:`121249`.) + + * :mod:`typing`: * The following statements now cause ``DeprecationWarning``\ s to be emitted diff --git a/Misc/NEWS.d/next/Library/2026-05-04-05-22-48.gh-issue-121249.XN06Fd.rst b/Misc/NEWS.d/next/Library/2026-05-04-05-22-48.gh-issue-121249.XN06Fd.rst new file mode 100644 index 00000000000000..bf370f08d420c6 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2026-05-04-05-22-48.gh-issue-121249.XN06Fd.rst @@ -0,0 +1,2 @@ +Deprecate support for complex types in the :mod:`struct` module (formatting +characters ``'F'`` and ``'D'`` respectively).