Skip to content

gh-145633: remove remnants of the "unknown_format" (floats) in the struct module#146189

Merged
vstinner merged 1 commit intopython:mainfrom
skirpichev:remove-unknown-in-struct/145633
Mar 25, 2026
Merged

gh-145633: remove remnants of the "unknown_format" (floats) in the struct module#146189
vstinner merged 1 commit intopython:mainfrom
skirpichev:remove-unknown-in-struct/145633

Conversation

@skirpichev
Copy link
Member

@skirpichev skirpichev commented Mar 20, 2026

@vstinner
Copy link
Member

The following code was added by commit 964e02a:

+                                       /* Skip float and double, could be
+                                          "unknown" float format */
+                                       if (ptr->format == 'd' || ptr->format == 'f')
+                                               break;

When this change was made, 'd' format was implemented with _PyFloat_Unpack8() in little endian and big endian tables, and _PyFloat_Unpack8() had a if (double_format == unknown_format) code path.

The if (double_format == unknown_format) code path was recently removed by commit dae85c4 in the main branch.

So yeah, it makes sense to copy the little endian or big endian function as the native function in the _struct module.

Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

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

LGTM

@vstinner vstinner merged commit f2fcc49 into python:main Mar 25, 2026
56 checks passed
@skirpichev skirpichev deleted the remove-unknown-in-struct/145633 branch March 25, 2026 06:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants