Adding Py_PACK_VERSION

IMO, with any name we choose, if you see it in context you’ll almost certainly know what it does. Once you know it, it’s easier to associate PACK with bit-packing.

Anyway, I’m not attached to the name. So, Py_VERSION_AS_HEX and Py_VERSION_FULL_AS_HEX?

In CPython, it’s useful to define PY_VERSION_HEX.
In Cython, micro & release are used relatively often (git grep 0x030 and look for the ones with zeros). Though I’m not sure how many would be there if it was easy to omit them.

Perhaps more importantly, leaving the “full” version out would feel like an omission; as a user I’d wonder why we document the full format but only have a macro for part of it.

4 Likes