Python’s New Stable ABI

Are you tired of dealing with ***** compatibility issues when building extensions for your favorite programming language? Introducing…the New Stable ABI!

What is the New Stable ABI?
In short, it’s a promise that certain extensions compiled with CPython 3.x will be binary compatible with all subsequent versions of CPython 3.x. This means you can build an extension once and support multiple Python versions without having to worry about compatibility issues. It also makes life easier for alternate Python implementations, which can now target the Stable ABI instead of the full C API.

The New Stable ABI is not just a promise; it’s backed up by a manifesto (or rather, a “manifest” file). This human-maintained list ensures that only functions and data structures that are part of the Limited API (a subset of CPython’s C API) make their way into the Stable ABI.

How does it work?
The New Stable ABI is opt-in for Windows, but all other platforms use an implicit list of exported symbols. This means that functions and data structures not explicitly marked as part of the Limited API are automatically excluded from the Stable ABI.

But what about performance? Won’t restricting ourselves to a subset of CPython’s C API hurt our beloved Python extensions? Fear not, bro! The New Stable ABI actually trades stability for performance. Extensions built for specific CPython versions will automatically use faster macros instead of functions in the Stable ABI.

What about deprecated members? Won’t they cause issues like reduced performance or memory/resource leaks? Yes, but don’t worry! Deprecated members still work, and you can continue to use them if you really want to. But be warned: future Python versions may remove these members altogether, so it’s best to avoid using them whenever possible.

x. It’s backed up by a manifesto file that ensures only functions and data structures part of the Limited API make their way into the Stable ABI. And best of all, it trades stability for performance!

So go ahead, build your Python extensions using the New Stable ABI, and enjoy the peace of mind that comes with knowing they’ll work on any subsequent version of CPython 3.x.

SICORPS