[Python-Dev] Add Py_off_t and related APIs?

Antoine Pitrou solipsis at pitrou.net
Tue Jan 13 20:17:26 CET 2009


Martin v. Löwis <martin <at> v.loewis.de> writes:
> 
> -1. How many functions actually require that type?

Functions in the IO lib. I can't tell you how many, let's say a dozen.

> > (the motivation is systems where Py_ssize_t is 32-bits wide, but large file
> > support makes off_t 64 bits wide)
> 
> 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.
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?)




More information about the Python-Dev mailing list