Actually, there’s been an issue that has been bothering me, why not use macros to represent Python version? Using raw hexadecimal numbers seems a bit odd, even though it doesn’t affect functionality. I think it might be beneficial to add a macro similar to KERNEL_VERSION
to represent a Python version. This would make the code more readable when defining different versions of the API.
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03070000
replace with
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= Py_VERSION(3, 7)
So, it’s usage is obvious. It’s original version can be used
_Py_VERSION(3, 7, 2)
_Py_VERSION(3, 8, 1)
...