Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Doc/library/struct.rst
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,10 @@ platform-dependent.
.. versionchanged:: 3.14
Added support for the ``'F'`` and ``'D'`` formats.

Complex numbers may also be represented using two consecutive floating-point
format characters. In this case, the real part is stored first, followed by
the imaginary part. The format characters ``f`` and ``d`` determine the type
used for each component.
Comment on lines +283 to +286
Copy link
Member

@skirpichev skirpichev Jan 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The are note (10) right below. Much more precise and clear, IMO. What means "may also be"?

Are you used LLM to generate PR? It looks you haven't read the documentation by yourself. Please see this:

Maintainers may close issues and PRs that are not useful or productive, including those that are fully generated by AI. If a contributor repeatedly opens unproductive issues or PRs, they may be blocked.


Notes:

Expand Down
4 changes: 3 additions & 1 deletion Modules/_struct.c
Original file line number Diff line number Diff line change
Expand Up @@ -2696,7 +2696,9 @@ these can be preceded by a decimal repeat count:\n\
x: pad byte (no data); c:char; b:signed byte; B:unsigned byte;\n\
?: _Bool (requires C99; if not available, char is used instead)\n\
h:short; H:unsigned short; i:int; I:unsigned int;\n\
l:long; L:unsigned long; f:float; d:double; e:half-float.\n\
l:long; L:unsigned long; f:float; d:double; e:half-float.\n\
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That change is unrelated.

For complex numbers, the real and imaginary parts are represented by two\n\
consecutive values of the specified floating-point type.\n\
Comment on lines +2700 to +2701
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Misleading. No one "specified" a "floating-point type". 'F' and 'D' formats specify a complex C types.

BTW, there are already opened PR (#143675). Next time please check the issue thread and comment why you would like to open an extra PR.

I think it's better to close this. But CC @vstinner

Special cases (preceding decimal count indicates length):\n\
s:string (array of char); p: pascal string (with count byte).\n\
Special cases (only available in native format):\n\
Expand Down
Empty file added test_PAT.txt
Empty file.
Loading