12.4.1 Plain Integer Objects

PyIntObject
This subtype of PyObject represents a Python integer object.

PyTypeObject PyInt_Type
This instance of PyTypeObject represents the Python plain integer type.

int PyInt_Check (PyObject *)

PyIntObject * PyInt_FromLong (long ival)
creates a new integer object with a value of ival.

The current implementation keeps an array of integer objects for all integers between -1 and 100, when you create an int in that range you actually just get back a reference to the existing object. So it should be possible to change the value of 1. I suspect the behaviour of python in this case is undefined. :-)

long PyInt_AS_LONG (PyIntObject *io)
returns the value of the object io.

long PyInt_AsLong (PyObject *io)
will first attempt to cast the object to a PyIntObject, if it is not already one, and the return it's value.

long PyInt_GetMax ()
returns the systems idea of the largest int it can handle (LONG_MAX, as defined in the system header files)



guido@CNRI.Reston.Va.US