Repository navigation
Remove "unknown_format" code path in PyFloat_Pack/Unpack*() #145633
Description
Activity
- addedinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)buildThe build process and cross-buildThe build process and cross-build3.15bugs and security fixesbugs and security fixes
on Mar 8, 2026 - addedextension-modulesC modules in the Modules dirC modules in the Modules dirinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)and removedinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)extension-modulesC modules in the Modules dirC modules in the Modules dir
on Mar 8, 2026 cc @diegorusso
I tried but failed to remove this code.
Do you remember why?
I don't recall exactly. I think that I didn't understand well which platforms use "unknown format" and I was afraid of breaking anything.
Reacted by Sergey B KirpichevI tried but failed to remove this code.
Do you remember why?
I don't recall exactly. I think that I didn't understand well which platforms use "unknown format" and I was afraid of breaking anything.
Before merging, should we run the PR attaches via buildbot?
37 remaining items
I agree with dropping untested code, but I don't think we should prevent porting CPython to old (or future) non-IEEE platforms.
The only way to do this is to revert choice made. Thread: https://mail.python.org/archives/list/python-dev@python.org/thread/J5FSP6J4EITPY5C2UJI7HSL2GQCTCUWN/
I would say it will be a step backward.
- added 5 commits that reference this issue
on Apr 25, 2026 https://discuss.python.org/t/deprecate-float-getformat/107151 - discussion of
__getformat__removal.Lets close this. If someone wish to continue - it would be better to open a new issue.
I opened one in the C API WG repo: capi-workgroup/decisions#107
- added a commit that references this issue
on Jul 10, 2026 - added a commit that references this issue
on Jul 10, 2026
This is a follow-up of the #91073. Proposal was briefly discussed in the referenced issue.
Now support for IEEE floating-point formats is a requirement and the configure script will fail, if it can't detect it. The only exception is some ARM platforms (this come from b08a53a):
cpython/configure.ac
Lines 6172 to 6180 in 149c465
This is only case, when "unknown_format" code patch now could be triggered (BTW, we could detect this format in runtime and switch to yet another "just copy bytes" path). Should we keep this for an unsupported platform? IIRIC, such chips aren't supported even in Debian.
With "unknown_format" we also could drop code to detect endianness in runtime. I'm not sure about
float.__getformat__function. It's docstring says:Probably, it could be treated as private and we should remove it in favor of using configure macros in tests. (
__set_format__()method was removed without prior deprecation in 5ab745f). Edit: we could also leave this also as-is for alternative Python implementations, using CPython tests.Linked PRs