[Python-Dev] Changing ob_size to [s]size_t

Guido van Rossum guido@python.org
Thu, 06 Jun 2002 09:19:46 -0400

> What terrible things would happen if ob_size would be changed from int
> to size_t?

Binary incompatibility on 64-bit platforms, for one.

Also, many other APIs would have to be changed: everything that takes
or returns an int (e.g. PyObject_Size, PySequence_GetItem) would have
to be changed, and again would be a binary incompatibility.  Also
could cause lots of compilation warnings when user code stores the
result into an int.

> The question recently came up on comp.lang.python, where the poster
> noticed that you cannot mmap large files on a 64-bit system where int
> is 32 bits; there is a 2Gib limit on the length of objects on his
> specific system.

That is indeed painful.

> About the only problem I can see is that you could not store negative
> numbers anymore. Is ssize_t universally available, or could be used on
> systems where it is available?

I've never heard of if, so it must be a relatively newfangled
thing. :-)

--Guido van Rossum (home page: http://www.python.org/~guido/)