Low-Level Functions on Built-in Types

The functions in Tables B.9 through B.21 can be used to manipulate various 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 >_From<type > are used to create a Python object from a C datatype. Functions of the form Py<type >_As<type > are used to convert from Python to C. These functions are presented without further description.

Table B.9. Integers
Type Function
long PyInt_AsLong(PyObject *iobj )
int PyInt_Check(PyObject *obj )
PyObject * PyInt_FromLong(long)
long PyInt_GetMax(void)
Table B.10. Long Integers
Type Function
double PyLong_AsDouble(PyObject *lobj )
long PyLong_AsLong(PyObject ...

Get Python Essential Reference, Second 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.