[Python-Dev] before I open an issue re: posix.stat and/or os.stat
larry at hastings.org
Mon Feb 25 18:30:54 EST 2019
On 2/21/19 2:26 AM, Michael wrote:
> Will this continue to be enough space - i.e., is the Dev size going to
> be enough?
> +2042 #ifdef MS_WINDOWS
> +2043 PyStructSequence_SET_ITEM(v, 2,
> +2044 #else
> +2045 PyStructSequence_SET_ITEM(v, 2, _PyLong_FromDev(st->st_dev));
> +2046 #endif
> +711 #define _PyLong_FromDev PyLong_FromLongLong
> It seems so - however, Is there something such as PyUnsignedLong and is
> that large enough for a "long long"? and if it exists, would that make
> the value positive (for the first test).
Surely you can answer this second question yourself? You do have full
source to the CPython interpreter.
To answer your question: there is no PyUnsignedLong. Python 2 has a
"native int" PyIntObject, which is for most integers you see in a
program, and a "long" PyLongObject which is those integers that end in
L. Python 3 only has the PyLongObject, which is used for all integers.
The PyLongObject is an "arbitrary-precision integer":
and can internally expand as needed to accommodate any size integer,
assuming you have enough heap space. Any "long long", unsigned or not,
on any extant AIX platform, would be no problem to represent in a
PyLongObject. You should use PyLong_FromLongLong or
PyLong_FromUnsignedLongLong to create your PyLong object and populate
the st_dev field of the os.stat() structsequence.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-Dev