/usr/share/doc/python2-docs/html/_sources/c-api
NameSizeModeActions
abstract.rst.txt7020644editdlrm
allocation.rst.txt47960644editdlrm
arg.rst.txt260040644editdlrm
bool.rst.txt13040644editdlrm
buffer.rst.txt229650644editdlrm
bytearray.rst.txt21810644editdlrm
capsule.rst.txt57410644editdlrm
cell.rst.txt19400644editdlrm
class.rst.txt18660644editdlrm
cobject.rst.txt18700644editdlrm
code.rst.txt16350644editdlrm
codec.rst.txt46430644editdlrm
complex.rst.txt40790644editdlrm
concrete.rst.txt19630644editdlrm
conversion.rst.txt70920644editdlrm
datetime.rst.txt64130644editdlrm
descriptor.rst.txt12960644editdlrm
dict.rst.txt77570644editdlrm
exceptions.rst.txt353040644editdlrm
file.rst.txt61980644editdlrm
float.rst.txt33710644editdlrm
function.rst.txt24210644editdlrm
gcsupport.rst.txt65870644editdlrm
gen.rst.txt9200644editdlrm
import.rst.txt112210644editdlrm
index.rst.txt5780644editdlrm
init.rst.txt491600644editdlrm
int.rst.txt45780644editdlrm
intro.rst.txt284730644editdlrm
iter.rst.txt13900644editdlrm
iterator.rst.txt17960644editdlrm
list.rst.txt63620644editdlrm
long.rst.txt79870644editdlrm
mapping.rst.txt28740644editdlrm
marshal.rst.txt39850644editdlrm
memory.rst.txt115560644editdlrm
method.rst.txt20990644editdlrm
module.rst.txt38670644editdlrm
none.rst.txt6970644editdlrm
number.rst.txt119390644editdlrm
objbuffer.rst.txt25160644editdlrm
object.rst.txt174910644editdlrm
objimpl.rst.txt3050644editdlrm
refcounting.rst.txt29340644editdlrm
reflection.rst.txt15670644editdlrm
sequence.rst.txt87160644editdlrm
set.rst.txt65880644editdlrm
slice.rst.txt29790644editdlrm
string.rst.txt154220644editdlrm
structures.rst.txt149660644editdlrm
sys.rst.txt57140644editdlrm
tuple.rst.txt54910644editdlrm
type.rst.txt27610644editdlrm
typeobj.rst.txt669360644editdlrm
unicode.rst.txt451260644editdlrm
utilities.rst.txt4150644editdlrm
veryhigh.rst.txt133630644editdlrm
weakref.rst.txt28200644editdlrm
Edit: /usr/share/doc/python2-docs/html/_sources/c-api/int.rst.txt (4578B)
.. highlightlang:: c .. _intobjects: Plain Integer Objects --------------------- .. index:: object: integer .. c:type:: PyIntObject This subtype of :c:type:`PyObject` represents a Python integer object. .. c:var:: PyTypeObject PyInt_Type .. index:: single: IntType (in modules types) This instance of :c:type:`PyTypeObject` represents the Python plain integer type. This is the same object as ``int`` and ``types.IntType``. .. c:function:: int PyInt_Check(PyObject *o) Return true if *o* is of type :c:data:`PyInt_Type` or a subtype of :c:data:`PyInt_Type`. .. versionchanged:: 2.2 Allowed subtypes to be accepted. .. c:function:: int PyInt_CheckExact(PyObject *o) Return true if *o* is of type :c:data:`PyInt_Type`, but not a subtype of :c:data:`PyInt_Type`. .. versionadded:: 2.2 .. c:function:: PyObject* PyInt_FromString(char *str, char **pend, int base) Return a new :c:type:`PyIntObject` or :c:type:`PyLongObject` based on the string value in *str*, which is interpreted according to the radix in *base*. If *pend* is non-*NULL*, ``*pend`` will point to the first character in *str* which follows the representation of the number. If *base* is ``0``, the radix will be determined based on the leading characters of *str*: if *str* starts with ``'0x'`` or ``'0X'``, radix 16 will be used; if *str* starts with ``'0'``, radix 8 will be used; otherwise radix 10 will be used. If *base* is not ``0``, it must be between ``2`` and ``36``, inclusive. Leading spaces are ignored. If there are no digits, :exc:`ValueError` will be raised. If the string represents a number too large to be contained within the machine's :c:type:`long int` type and overflow warnings are being suppressed, a :c:type:`PyLongObject` will be returned. If overflow warnings are not being suppressed, *NULL* will be returned in this case. .. c:function:: PyObject* PyInt_FromLong(long ival) Create a new integer object with a value of *ival*. The current implementation keeps an array of integer objects for all integers between ``-5`` and ``256``, 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. :-) .. c:function:: PyObject* PyInt_FromSsize_t(Py_ssize_t ival) Create a new integer object with a value of *ival*. If the value is larger than ``LONG_MAX`` or smaller than ``LONG_MIN``, a long integer object is returned. .. versionadded:: 2.5 .. c:function:: PyObject* PyInt_FromSize_t(size_t ival) Create a new integer object with a value of *ival*. If the value exceeds ``LONG_MAX``, a long integer object is returned. .. versionadded:: 2.5 .. c:function:: long PyInt_AsLong(PyObject *io) Will first attempt to cast the object to a :c:type:`PyIntObject`, if it is not already one, and then return its value. If there is an error, ``-1`` is returned, and the caller should check ``PyErr_Occurred()`` to find out whether there was an error, or whether the value just happened to be ``-1``. .. c:function:: long PyInt_AS_LONG(PyObject *io) Return the value of the object *io*. No error checking is performed. .. c:function:: unsigned long PyInt_AsUnsignedLongMask(PyObject *io) Will first attempt to cast the object to a :c:type:`PyIntObject` or :c:type:`PyLongObject`, if it is not already one, and then return its value as unsigned long. This function does not check for overflow. .. versionadded:: 2.3 .. c:function:: unsigned PY_LONG_LONG PyInt_AsUnsignedLongLongMask(PyObject *io) Will first attempt to cast the object to a :c:type:`PyIntObject` or :c:type:`PyLongObject`, if it is not already one, and then return its value as unsigned long long, without checking for overflow. .. versionadded:: 2.3 .. c:function:: Py_ssize_t PyInt_AsSsize_t(PyObject *io) Will first attempt to cast the object to a :c:type:`PyIntObject` or :c:type:`PyLongObject`, if it is not already one, and then return its value as :c:type:`Py_ssize_t`. .. versionadded:: 2.5 .. c:function:: long PyInt_GetMax() .. index:: single: LONG_MAX Return the system's idea of the largest integer it can handle (:const:`LONG_MAX`, as defined in the system header files). .. c:function:: int PyInt_ClearFreeList() Clear the integer free list. Return the number of items that could not be freed. .. versionadded:: 2.6