deimos.python.intobject

Mirror intobject.h

Integer object interface

PyIntObject represents a (long) integer. This is an immutable object; an integer cannot change its value after creation.

There are functions to create new integer objects, to test an object for integer-ness, and to get the integer value. The latter functions returns -1 and sets errno to EBADF if the object is not an PyIntObject. None of the functions should be applied to nil objects.

The type PyIntObject is (unfortunately) exposed here so we can declare _Py_TrueStruct and _Py_ZeroStruct in boolobject.h; don't use this.

Note intobject has gone away in favor of longobject in python 3.

Members

Functions

PyInt_AsLong
C_long PyInt_AsLong(PyObject*)

Availability: 2.*

PyInt_AsSsize_t
Py_ssize_t PyInt_AsSsize_t(PyObject*)

Availability: 2.5, 2.6, 2.7

PyInt_AsUnsignedLongLongMask
C_ulonglong PyInt_AsUnsignedLongLongMask(PyObject*)

Availability: 2.*

PyInt_AsUnsignedLongMask
C_ulong PyInt_AsUnsignedLongMask(PyObject*)

Availability: 2.*

PyInt_Check
int PyInt_Check(PyObject* op)

Availability: 2.*

PyInt_CheckExact
int PyInt_CheckExact(PyObject* op)

Availability: 2.*

PyInt_ClearFreeList
int PyInt_ClearFreeList()

free list api */ /// Availability: >= 2.

PyInt_FromLong
PyObject* PyInt_FromLong(C_long)

Availability: 2.*

PyInt_FromSize_t
PyObject* PyInt_FromSize_t(size_t)

Availability: 2.5, 2.6, 2.7

PyInt_FromSsize_t
PyObject* PyInt_FromSsize_t(Py_ssize_t)

Availability: 2.5, 2.6, 2.7

PyInt_FromString
PyObject* PyInt_FromString(char*, char**, int)

Availability: 2.*

PyInt_FromUnicode
PyObject* PyInt_FromUnicode(Py_UNICODE*, Py_ssize_t, int)

Availability: 2.*

PyInt_GetMax
C_long PyInt_GetMax()

Accessible at the Python level as sys.maxint

PyOS_strtol
C_long PyOS_strtol(char*, char**, int)

Availability: 2.*

PyOS_strtol
C_long PyOS_strtol(char*, char**, int)

Availability: >= 2.6

PyOS_strtoul
C_ulong PyOS_strtoul(char*, char**, int)

Availability: 2.*

_PyInt_Format
PyObject* _PyInt_Format(PyIntObject* v, int base, int newstyle)

Convert an integer to the given base. Returns a string. If base is 2, 8 or 16, add the proper prefix '0b', '0o' or '0x'. If newstyle is zero, then use the pre-2.6 behavior of octal having a leading "0" */ /// Availability: >= 2.

_PyInt_FormatAdvanced
PyObject* _PyInt_FormatAdvanced(PyObject* obj, char* format_spec, Py_ssize_t format_spec_len)

Format the object based on the format_spec, as defined in PEP 3101 (Advanced String Formatting). */ /// Availability: >= 2.

Structs

PyIntObject
struct PyIntObject

subclass of PyObject Availability: 2.*

Meta