Skip to content

PEP 689: Semi-stable C API tier #2559

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

Merged
merged 2 commits into from
Apr 27, 2022
Merged

PEP 689: Semi-stable C API tier #2559

merged 2 commits into from
Apr 27, 2022

Conversation

encukou
Copy link
Member

@encukou encukou commented Apr 26, 2022

@encukou encukou requested a review from a team as a code owner April 26, 2022 12:21
Copy link
Member

@AA-Turner AA-Turner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More comments than I intended, sorry! Some are very trivial, some are larger points (although I'm not an expert in the C-API, so please ignore things that I've gotten wrong).

A

pep-0689.rst Outdated
Comment on lines 34 to 36
We need a tier between Public and Private to accomodate tools like
advanced debuggers and JIT compilers, which need access to CPython
internals but assume the C-API they use does not change in patch releases.
Copy link
Member

@AA-Turner AA-Turner Apr 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style / semantics -- I would phrase this the other way around, introducing the requirement first rather than "We need". Something like:

Suggested change
We need a tier between Public and Private to accomodate tools like
advanced debuggers and JIT compilers, which need access to CPython
internals but assume the C-API they use does not change in patch releases.
Tools requring access to CPython internals (e.g. advanced
debuggers and JIT compilers) are often built for minor series releases
of CPython, and assume that the C-API interals used do not change
in patch releases. To support these tools, we need a tier between the
Public and Private C-API, with guarantees on stability throughout
the minor-series release.

Caveat: this is a stab at language, my terminology might be far off the mark, and it may be entirely out of line with what you intend to express.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is what I wanted to say, but it uses twice as much text to say it.
Why is it better? (That's a genuine question.)

Copy link
Member

@AA-Turner AA-Turner Apr 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current wording is in the rationale section, which is setting out the justification for the proposal. To me, it seems odd to phrase it "We need <feature> because <thing> requires <requirement>, but we don't guarantee requirement.

My suggested rephrasing more explicity spells out that we want to support <thing> properly, there is a reason the current state doesn't work (no guarantees at an API level of stability), and hence <feature> is needed that provides those guarantees.

So this was more a "readability" suggestion, though as author you very much have the right to reject it!

A

Open Issues
===========

- “Semi-stable” is not a perfect name.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sphinx will auto-convert the quotes.

Suggested change
- Semi-stable is not a perfect name.
- "Semi-stable" is not a perfect name.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But it accepts proper quotes as well, as far as I know.

Specification
=============

Several functions and types (“APIs”) will be moved to a new *semi-stable* tier.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Several functions and types (APIs) will be moved to a new *semi-stable* tier.
Several functions and types ("APIs") will be moved to a new *semi-stable* tier.

stability.

However, leading underscores usually mark *fully private* API.
CPython developers familiar with the “underscore means internal”
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
CPython developers familiar with the underscore means internal
CPython developers familiar with the "underscore means internal"

Rejected Ideas
==============

It might be good to add a similar tier in the Python (not C) API,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like in practice this is already true for e.g. the ast module; I think Guido brought that up in the past too.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But like with CodeType, there's no warning outside the documentation. It's easy to miss this in a review.

Open Issues
===========

- “Semi-stable” is not a perfect name.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really like the name either, but haven't been able to think of anything better.

pep-0689.rst Outdated
Comment on lines 34 to 36
We need a tier between Public and Private to accomodate tools like
advanced debuggers and JIT compilers, which need access to CPython
internals but assume the C-API they use does not change in patch releases.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is what I wanted to say, but it uses twice as much text to say it.
Why is it better? (That's a genuine question.)

Rejected Ideas
==============

It might be good to add a similar tier in the Python (not C) API,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But like with CodeType, there's no warning outside the documentation. It's easy to miss this in a review.

Co-authored-by: Adam Turner <[email protected]>
Co-authored-by: Jelle Zijlstra <[email protected]>
@encukou
Copy link
Member Author

encukou commented Apr 27, 2022

Thank you for the editing!
I'll merge so the PEP can be reviewed on python-dev; I don't mean to ignore the unresolved conversations.

@encukou encukou merged commit 7f53796 into python:main Apr 27, 2022
@encukou encukou deleted the pep-semistable branch April 27, 2022 13:13
@CAM-Gerlach CAM-Gerlach added the new-pep A new draft PEP submitted for initial review label May 3, 2022
encukou pushed a commit to encukou/peps that referenced this pull request May 3, 2022
> The current wording is in the rationale section, which is
> setting out the justification for the proposal. To me, it
> seems odd to phrase it "We need <feature> because <thing>
> requires <requirement>, but we don't guarantee requirement.
>
> My suggested rephrasing more explicity spells out that we
> want to support <thing> properly, there is a reason the
> current state doesn't work (no guarantees at an API level
> of stability), and hence <feature> is needed that provides
> those guarantees.

- python#2559 (comment)
encukou added a commit to encukou/peps that referenced this pull request May 3, 2022
> The current wording is in the rationale section, which is
> setting out the justification for the proposal. To me, it
> seems odd to phrase it "We need <feature> because <thing>
> requires <requirement>, but we don't guarantee requirement.
>
> My suggested rephrasing more explicity spells out that we
> want to support <thing> properly, there is a reason the
> current state doesn't work (no guarantees at an API level
> of stability), and hence <feature> is needed that provides
> those guarantees.

- python#2559 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-pep A new draft PEP submitted for initial review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants