7.4.2 Long Integer Objects

PyLongObject
This subtype of PyObject represents a Python long integer object.

PyTypeObject PyLong_Type
This instance of PyTypeObject represents the Python long integer type.

int PyLong_Check(PyObject *p)
Returns true if its argument is a PyLongObject.

PyObject* PyLong_FromLong(long v)
Returns a new PyLongObject object from v.

PyObject* PyLong_FromUnsignedLong(unsigned long v)
Returns a new PyLongObject object from an unsigned C long.

PyObject* PyLong_FromDouble(double v)
Returns a new PyLongObject object from the integer part of v.

long PyLong_AsLong(PyObject *pylong)
Returns a C long representation of the contents of pylong. WHAT HAPPENS IF pylong is greater than LONG_MAX?

unsigned long PyLong_AsUnsignedLong(PyObject *pylong)
Returns a C unsigned long representation of the contents of pylong. WHAT HAPPENS IF pylong is greater than ULONG_MAX?

double PyLong_AsDouble(PyObject *pylong)
Returns a C double representation of the contents of pylong.

PyObject* PyLong_FromString(char *str, char **pend, int base)