Skip to content
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

bpo-43795: PEP 652 user documentation #25668

Merged
merged 14 commits into from May 11, 2021
Merged

Conversation

@encukou
Copy link
Member

@encukou encukou commented Apr 27, 2021

  • Reformat the C API and ABI Versioning page (and extend/clarify a bit)
  • Rewrite the stable ABI docs into a general text on C API Compatibility
  • Add a list of Limited API contents, and notes for the individual items.
  • Replace Include/README.rst with a link to a devguide page with the same info

https://bugs.python.org/issue43795

Automerge-Triggered-By: GH:encukou

encukou added 2 commits Apr 27, 2021
Mark up all the version macros, adding them to the index and allowing
links to them.

Clarify that these are resolved at build time.

Add an example for Python 3.10. Some people might assume this is 0x10,
not 0xA, based on how well PY_VERSION_HEX "reads" in hex.

Link to the (upcoming) page on API and ABI stability.
encukou added 5 commits Apr 29, 2021
This replaces the existing :stableabi:, which wasn't really used.

Doc/data/stable_abi.dat is expanded to include all relevant
info (kind of the symbol and version it was added in), and the
c_annotations Sphinx extension reads this file and adds
notes similar to ones added by :stableabi: (which wasn't really
used).

Relevant prior work: #23185
Co-authored-by: Will Ayd <william.ayd@icloud.com>
@encukou
Copy link
Member Author

@encukou encukou commented Apr 29, 2021

As per the PEP, I added a list of everything in the limited API, as well as notes in individual doc entries. A screenshot of the notes:

image

@encukou encukou marked this pull request as ready for review Apr 29, 2021
@encukou
Copy link
Member Author

@encukou encukou commented May 6, 2021

The docs notes will now show platform restrictions, based on #ifdef, like the “on Windows" here:

image

Copy link
Member

@orsenthil orsenthil left a comment

This looks good to me. I had few nits to clarify.

Doc/c-api/apiabiversion.rst Show resolved Hide resolved
Doc/c-api/apiabiversion.rst Outdated Show resolved Hide resolved
Copy link
Contributor

@willingc willingc left a comment

Thank you @encukou. Nice work improving clarity here. I've made a few suggestions for consideration. Thanks again ☀️


Thus ``3.4.1a2`` is hexversion ``0x030401a2``.
CPython exposes its version number in the following macros.
Note that these correspond to the version code is built with,

This comment has been minimized.

@willingc

willingc May 7, 2021
Contributor

Perhaps bold part of this sentence re: build version vs run-time version.

version information can be found by treating it as a 32 bit number in
the following manner:

+-------+-------------------------+-------------------------+

This comment has been minimized.

@willingc

willingc May 7, 2021
Contributor

Nice table as an example 😄

(x>=2) on the particular :ref:`platform <stable-abi-platform>`.

Defining ``Py_LIMITED_API`` to a value of :c:data:`PY_VERSION_HEX` will
do the same, but allow additional API added up to specified version,

This comment has been minimized.

@willingc

willingc May 7, 2021
Contributor

Great improvements to this section. The wording in this item is slightly confusing. Does this mean: It will use the Limited API for this version and later versions. Earlier versions lose compatibility since additional API may exist prior to this version.

This comment has been minimized.

@encukou

encukou May 7, 2021
Author Member

Thanks for the note! It really helps to have a second set of eyes here.
I've shuffled the paragraph around; hopefully things are clearer with this order.


For example, while :c:func:`PyList_GetItem` is available, its “unsafe” macro
variant :c:func:`PyList_GET_ITEM` is not.
The macro can be faster because it can rely on version-specific implementation

This comment has been minimized.

@willingc

willingc May 7, 2021
Contributor

Good example.

@encukou
Copy link
Member Author

@encukou encukou commented May 7, 2021

Thank you for the thoughtful comments!

@miss-islington miss-islington merged commit b05955d into python:main May 11, 2021
12 checks passed
12 checks passed
@github-actions
Docs
Details
@github-actions
Check for source changes
Details
@github-actions
Check if generated files are up to date
Details
@github-actions
Windows (x86)
Details
@github-actions
Windows (x64)
Details
@github-actions
macOS
Details
@github-actions
Ubuntu
Details
@github-actions
Ubuntu SSL tests with OpenSSL
Details
Azure Pipelines PR #20210507.31 succeeded
Details
@travis-ci
Travis CI - Pull Request Build Passed
Details
@bedevere-bot
bedevere/issue-number Issue number 43795 found
Details
@bedevere-bot
bedevere/news "skip news" label found
@miss-islington
Copy link
Contributor

@miss-islington miss-islington commented May 11, 2021

Sorry, I can't merge this PR. Reason: Base branch was modified. Review and try the merge again..

@miss-islington
Copy link
Contributor

@miss-islington miss-islington commented May 11, 2021

Thanks @encukou for the PR 🌮🎉.. I'm working now to backport this PR to: 3.10.
🐍🍒🤖

@bedevere-bot
Copy link

@bedevere-bot bedevere-bot commented May 11, 2021

GH-26034 is a backport of this pull request to the 3.10 branch.

@encukou encukou deleted the encukou:pep652-document branch May 11, 2021
@encukou
Copy link
Member Author

@encukou encukou commented May 11, 2021

This can be confusing; more and more often and I need a page to link to. So I merged this.
However, I'd be happy for more suggestions/improvements :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants