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

Add a page on changing the C API (PEP-652) #682

Merged
merged 3 commits into from May 4, 2021
Merged

Conversation

@encukou
Copy link
Member

@encukou encukou commented Apr 29, 2021

This repeats points currently said in Include/README.rst.
I intend to replace most of that README with a link to this document.

The main change from that document are:

  • The three "rings" are not defined by where things are declared.
    It would be good to have them in the right place, but it's
    not yet the case, and for technical reasons we might never reach
    the ideal. (In Include/README.rst it makes more sense to make
    the locations more prominent.)
  • The order is switched. For changing the Limited API you generally
    need to read (and follow guidelines in) the preceding sections
    as well.

I added points from PEP-652 (Maintaining the Stable ABI).

This repeats points currently said in `Include/README.rst`.
I intend to replace most of that README with a link to this document.

The main change from that document are:
- The three "rings" are not defined by where things are declared.
  It would be good to have them in the right place, but it's
  not yet the case, and for technical reasons we might never reach
  the ideal. (In `Include/README.rst` it makes more sense to make
  the locations more prominent.)
- The order is switched. For changing the Limited API you generally
  need to read (and follow guidelines in) the preceding sections
  as well.

I added points from PEP 652 (Maintaining the Stable ABI).
@encukou encukou force-pushed the encukou:c-api branch from f98bc57 to 18edee8 Apr 29, 2021
@encukou
Copy link
Member Author

@encukou encukou commented Apr 29, 2021

The page, rendered on RTD: https://cpython-devguide--682.org.readthedocs.build/c-api/

@erlend-aasland, you wrote Include/README.rst. Does this PR look OK to you?

Note that I also want to improve Doc/c-api/stable.rst: python/cpython#25668

encukou added a commit to encukou/cpython that referenced this pull request Apr 29, 2021
Copy link
Contributor

@erlend-aasland erlend-aasland left a comment

LGTM, with some nitpicks :)

c-api.rst Outdated Show resolved Hide resolved
c-api.rst Outdated

- Please start a public discussion before expanding the Limited API

- The limited API and its intended use must follow standard C, not just

This comment has been minimized.

@erlend-aasland

erlend-aasland Apr 30, 2021
Contributor

Suggested change
- The limited API and its intended use must follow standard C, not just
- The Limited API and its intended use must follow standard C, not just

(Nit: I find the "its intended use" part a tiny bit weird. Can it be reformulated?)

This comment has been minimized.

@erlend-aasland

erlend-aasland Apr 30, 2021
Contributor

Also, the "follow standard C" part is covered in line 130.

c-api.rst Outdated Show resolved Hide resolved
c-api.rst Outdated Show resolved Hide resolved
1. The internal, private API, available with ``Py_BUILD_CORE`` defined.
Ideally declared in ``Include/internal/``. Any API named with a leading
underscore is also considered private.
2. The public C API, available when ``Python.h`` is included normally.

This comment has been minimized.

@erlend-aasland

erlend-aasland Apr 30, 2021
Contributor

Maybe drop "normally"?

This comment has been minimized.

@encukou

encukou May 4, 2021
Author Member

By normally I mean without defining macros to select the other variants. I'll expand that in the section below.

@encukou
Copy link
Member Author

@encukou encukou commented May 4, 2021

Thanks for the comments!
Do things look better now?

Copy link
Contributor

@erlend-aasland erlend-aasland left a comment

LGTM :)

@encukou encukou merged commit 9b6b939 into python:master May 4, 2021
3 checks passed
3 checks passed
@github-actions
test w/ Python 3.9 test w/ Python 3.9
Details
@travis-ci
Travis CI - Pull Request Build Passed
Details
docs/readthedocs.org:cpython-devguide Read the Docs build succeeded!
Details
@encukou encukou deleted the encukou:c-api branch May 4, 2021
@encukou
Copy link
Member Author

@encukou encukou commented May 4, 2021

Thanks!

@vstinner
Copy link
Member

@vstinner vstinner commented May 26, 2021

https://devguide.python.org/c-api/ is great, thanks @encukou!

Next step: document C API removal ;-)

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

Successfully merging this pull request may close these issues.

None yet

4 participants