◐ Shell
clean mode source ↗

bpo-46906: Mention PY_BIG_ENDIAN in PyFloat_Pack8() doc by vstinner · Pull Request #31832 · python/cpython

Choose a reason for hiding this comment

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

That seems confusing.

Agreed, but it's primarily a problem with the naming of PY_BIG_ENDIAN, which would perhaps be better spelled as something like PY_PLATFORM_ENDIAN_IS_BIG_ENDIAN.

But usage of PY_BIG_ENDIAN is at least a little bit problematic, since there's nothing anywhere in C that guarantees that integer types and float types will use the same endianness (or even that float types have to follow one of big-endian or little-endian at all).

Maybe we could accept -1 to mean "use native endian"?

I'd suggest leaving it as-is - it's easy enough to pass PY_BIG_ENDIAN.