-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
gh-127253: Note that Stable ABI is about ABI stability #127254
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,8 +66,8 @@ | |
|
||
Python 3.2 introduced the *Limited API*, a subset of Python's C API. | ||
Extensions that only use the Limited API can be | ||
compiled once and work with multiple versions of Python. | ||
compiled once and be loaded on multiple versions of Python. | ||
Contents of the Limited API are :ref:`listed below <limited-api-list>`. | ||
|
||
.. c:macro:: Py_LIMITED_API | ||
|
||
|
@@ -76,7 +76,7 @@ | |
|
||
Define ``Py_LIMITED_API`` to the value of :c:macro:`PY_VERSION_HEX` | ||
corresponding to the lowest Python version your extension supports. | ||
The extension will work without recompilation with all Python 3 releases | ||
The extension will be ABI-compatible with all Python 3 releases | ||
from the specified one onward, and can use Limited API introduced up to that | ||
version. | ||
|
||
|
@@ -94,8 +94,16 @@ | |
---------- | ||
|
||
To enable this, Python provides a *Stable ABI*: a set of symbols that will | ||
remain compatible across Python 3.x versions. | ||
remain ABI-compatible across Python 3.x versions. | ||
|
||
.. note:: | ||
|
||
The Stable ABI prevents ABI issues, like linker errors due to missing | ||
symbols or data corruption due to changes in structure layouts or function | ||
signatures. | ||
However, other changes in Python can change the *behavior* of extensions. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It might be worth adding a small example here (e.g., reference counts, per the motivating issue). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think one example would do. Reference counts are less of a motivating issue and more of the straw that broke the camel's back. |
||
See Python's Backwards Compatibility Policy (:pep:`387`) for details. | ||
|
||
The Stable ABI contains symbols exposed in the :ref:`Limited API | ||
<limited-c-api>`, but also other ones – for example, functions necessary to | ||
support older versions of the Limited API. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be better to use
ABI Compatible
here instead ofloaded on
as the latter means that extension module can be loaded which may not be the case if the extension uses any function which now raises error while importing.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the suggestion.
This intro is meant to communicate the intent of the limited API, rather than give the precise description. I'd rather leave the term “ABI Compatible” to the sections below, which should also clear up which “multiple versions” the extension will work with.