HPy: a better C API for Python
- Liffey A
- 14:30 on 13 July 2022
- 30 minutes
The official Python C API is specific to the current implementation of CPython. It has served us well and forms the basis upon which our entire extension ecosystem rests. However, it exposes a lot of internal details which makes it hard to implement it for other Python implementations (e.g. PyPy, GraalPython, Jython, IronPython, etc.), and prevents major evolutions of CPython itself, such as using a GC instead of refcounting, or removing the GIL.
This is where HPy comes in. It's a new C API designed from the ground up according to the following goals:
- running much faster on alternate implementations, and at native speed on CPython
- making it possible to compile a single binary which runs unmodified on all supported Python implementations and versions
- being simpler and more manageable than the Python/C API
- providing an improved debugging experience.
We'll discuss its current status and show how existing extensions can be gradually ported to it.