Since 3.11, building CPython requires support for “IEEE” floating-point format and NaN. The discussion's consensus seems to be “CPython requires IEEE 754 floats, but the Python language does not.” The requirement was added to simplify internals and avoid untested code paths, but, as Greg says on the thread:
Should a meaningful large-os platform come along that promotes the use of a
different format available from C we could make use of that and loosen the
policy as needed.
A 3.15 change made PyFloat_Pack8 and PyFloat_Unpack8 always succeed on CPython. I think that goes against the decision: error-less conversion means a 1:1 mapping, i.e. it effectively requires that double is IEEE binary64. Or at least that NaNs and infinities are available. Changing this (“loosening the policy”) would be painful: we'd probably need to remove the now-fallible functions, with a suitable deprecation period.
So, it would make sense to me to keep PyFloat_Pack* and PyFloat_Unpack8 fallible; infallibility should be an internal implementation detail, which we can drop in the next version.
What's your opinion?
Since 3.11, building CPython requires support for “IEEE” floating-point format and NaN. The discussion's consensus seems to be “CPython requires IEEE 754 floats, but the Python language does not.” The requirement was added to simplify internals and avoid untested code paths, but, as Greg says on the thread:
A 3.15 change made
PyFloat_Pack8andPyFloat_Unpack8always succeed on CPython. I think that goes against the decision: error-less conversion means a 1:1 mapping, i.e. it effectively requires thatdoubleis IEEE binary64. Or at least that NaNs and infinities are available. Changing this (“loosening the policy”) would be painful: we'd probably need to remove the now-fallible functions, with a suitable deprecation period.So, it would make sense to me to keep
PyFloat_Pack*andPyFloat_Unpack8fallible; infallibility should be an internal implementation detail, which we can drop in the next version.What's your opinion?