I am reading a binary data format which contains a length
field of type unsigned long long
using cython.
After reading this value, I cast it to a Py_ssize_t
variable to return to python space to be used in indexing.
Since Py_ssize_t
is signed, it's maximum positive range must be lower than the maximum value unsigned long long
.
Is there a general way of checking if the value I read can be stored in Py_ssize_t
? Or put differently: Is there a way to obtain the maximum positive value of Py_ssize_t
?