[Python-Dev] Add Py_off_t and related APIs?

Antoine Pitrou solipsis at pitrou.net
Tue Jan 13 19:24:09 CET 2009


Hello,

Python currently has an API to deal with size_t-like numbers (Py_ssize_t,
PyNumber_AsSsize_t), but it doesn't have similar facilities for off_t.

Is it ok to add the following:
 * a Py_off_t type which is typedef'd to either Py_LONG_LONG (Windows) or off_t
(others)
 * three C API functions: PyNumber_AsOff_t, PyLong_AsOff_t, PyLong_FromOff_t
 * an additional type code for PyArg_ParseTuple and friends; I suggest 'N' since
'n' currently means Py_ssize_t, and a Py_off_t should always be at least as wide
as a Py_ssize_t
?

(the motivation is systems where Py_ssize_t is 32-bits wide, but large file
support makes off_t 64 bits wide)

Thanks

Antoine.




More information about the Python-Dev mailing list