FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[3.15] gh-121249: Soft deprecate F and D struct format types (#149346) by vstinner · Pull Request #152274 · python/cpython · GitHub

/ cpython Public
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .rst  (3) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
5 changes: 5 additions & 0 deletions Doc/deprecations/soft-deprecations.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -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`.)
11 changes: 5 additions & 6 deletions Doc/library/struct.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -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) |
Expand All @@ -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::

Expand Down Expand Up @@ -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,
Expand Down
5 changes: 5 additions & 0 deletions Doc/whatsnew/3.15.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

Back | FazBrowse Home | New Git URL