Unless I've misunderstood this API, and the ByteArray
part doesn't refer
to an array of bytes representing the value of PyLong
in 2's complement, can
we implement this in the public header? It's already available, it's just not exported (at
least I can't use it, and it's not in the documentation).
This would be beneficial for fixed width integer types, especially ones larger than
long long
(e.g. __int128_t
), and shouldn't take much effort
since it's already implemented privately (https://github.com/python/cpython/blob/04fc4f2a46b2fd083639deb872c3a3037fdb4...).
Possibly include a function to return the size of the would-be array to be used as a
check?
Also since I have nowhere else to ask it, what's with PyLong_AsSignedType
doing type coercion for you, but PyLong_AsUnsignedType
not? (At least that's
what I gathered from the documentation)