Low-level Functions on Built-in Types

The functions in Tables 27.10 through 27.22 can be used to manipulate specific built-in types. Functions of the form Py<type>_Check() are used to check the type of an object and return 1 if an object is the correct type, 0 otherwise. Functions of the form Py<type>_CheckExact() perform the same task, but make sure that the object is exactly the appropriate type—not a type that has been derived via inheritance. Functions of the form Py<type>_From<type> are used to create a Python object from a C data type. Functions of the form Py<type>_As<type> are used to convert from Python to C.

Table 27.10. Integers
TypeFunction
longPyInt_AsLong(PyObject *iobj);
intPyInt_Check(PyObject *obj)
intPyInt_CheckExact(PyObject

Get Python: Essential Reference, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.