[Python-3000] PyInt_ to PyLong_ rename

Christian Heimes lists at cheimes.de
Sun Dec 2 19:26:36 CET 2007


A few hours ago I've renamed the remaining occurrences of PyInt_ to
PyLong_. Most PyInt_ were aliases for PyLong_ functions. I've also
removed the inclusion of intobject.h from Python.h but kept the file
with the aliases for porters from 2.x to 3.0. The remaining functions
are now in longobject.h.

longobject.h has still two PyInt_ functions: PyInt_GetMax and
PyInt_CheckExact.

long
PyInt_GetMax(void)
{
        return LONG_MAX;        /* To initialize sys.maxint */
}
It's only used for sys.maxint. Do we still need sys.maxint and
PyInt_GetMax()? IMO PyLong_GetNativeMax() and sys.maxnativelong are
better names.

The name for PyInt_CheckExact is confusing, too. It's defines as
PyInt_CheckExact(op) (PyLong_CheckExact(op) && _PyLong_FitsInLong(op)).
PyLong_CheckFitsInLong() or PyLong_CheckNativeLong() (Georg's idea) do
explain the meaning better.

The cleanup should make it much easier to rename PyLong to PyInt if
Guido decides to rename the type and functions after Alpa 2. A simple
find and xargs sed -i should be sufficient.

Christian


More information about the Python-3000 mailing list