Design a new better C API for Python

Subtitle: “Make the stable API usable”.

PyPy and Gilectomy projects are using different approaches to optimize Python, but their performance are limited by the current C API on C extensions. The C API should be “fixed” to unlock raw performances!

To be able to introduce backward incompatible changes to the C API without breaking too many C extensions, this project proposes two things:

  • design a helper layer providing removed functions;

  • a new Python runtime which is only usable with C extensions compiled with the new stricter and smaller C API (and the new stable ABI) for Python 3.8 and newer, whereas the existing “regular python” becomes the “regular runtime” which provides maximum backward compatibility with Python 3.7 and older.

The current C API has multiple issues:

  • The Python lifecycle is shorter than the lifecycle of some operating systems: how to get the latest Python on an “old” but stable operating system?

  • Python debug build is currently mostly unusable in practice, making development of C extension harder, especially debugging.

Existing C extensions will still be supported and will not have to be modified. The old C API is not deprecated and there is no plan penalize users of the old C API.

Table of Contents