Old C API

The “current” or “old” C API is the Python 3.7 API which “leaks” implementation details like PyObject.ob_refcnt through Py_INCREF() macro.

With the new C API, the old C API will remain available thanks to the regular runtime, for CPython internals, for specific use cases like Cython (for best performances) and debugging tools, but also for the long tail of C extensions on PyPI.

See also Calling conventions.

What is the Python C API?

  • Python objects

    • Protocol, Abstract

    • Types, Classes

  • Memory Allocators

  • Python initialization and configuration

  • Control flow

    • Generator

    • Exception: PyErr_SetString(), PyErr_Clear()

Current Python C API