[Python-Dev] Add Py_off_t and related APIs?

"Martin v. Löwis" martin at v.loewis.de
Tue Jan 13 21:33:28 CET 2009


>> For argument parsing, you should use "long long" if SIZEOF_OFF_T is 8
>> and long long is supported, and then assign to off_t as appropriate.
> 
> It's wrong, because floats would be accepted as argument to the seek() method.

I see.

> Hence the need for (at least) PyNumber_AsOff_t.
> (of course the IO lib can have its own private implementation of
> PyNumber_AsOff_t. But then why not make it benefit everyone?)

I would do this through a converter function (O&), but yes,
making it private to the io library sounds about right. Who
else would benefit from it?

If we start with that, we end up with ParseTuple formats for
uid_t, gid_t, pid_t, and the other dozen integral types that
POSIX has invented.

Regards,
Martin


More information about the Python-Dev mailing list