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/04fc4f2a46b2fd083639deb872c3a3037fdb47d6/Objects/longobject.c).
 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)
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/K2XJQUUELEXEO32YIG7WJ3KS5YK2URII/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to