FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Docs: Add classes to C API return value annotations by hugovk · Pull Request #117926 · python/cpython · GitHub

Repository navigation

Docs: Add classes to C API return value annotations - #117926

Merged
hugovk merged 5 commits into
python:mainfrom
hugovk:docs-c-api-return-value-classes
Apr 16, 2024
Merged

hugovk merged 5 commits into
python:mainfrom
hugovk:docs-c-api-return-value-classes

Conversation

hugovk commented Apr 16, 2024 •
edited
Loading

Copy link
Copy Markdown
Member

Currently light green is used for all return types

  • "Return value: Always NULL."
  • "Return value: New reference."
  • "Return value: Borrowed reference."

For example: https://docs.python.org/3/c-api/exceptions.html

Screenshots

A borrowed reference is not necessarily a "bad" thing, but we may want to use something other than green that indicates it's "good", to indicate they should be treated with care.

One option is yellow.

  1. These annotations are added in Doc/tools/extensions/c_annotations.py. The first step is to add CSS classes in this file.

  2. The light green colour is defined in https://github.com/python/python-docs-theme. The second step is to adjust the colours in the theme.

This PR also includes some light cleanup whilst we're touching this file, see commits.


📚 Documentation preview 📚: https://cpython-previews--117926.org.readthedocs.build/

hugovk added skip issue skip news docs Documentation in the Doc dir labels Apr 16, 2024

sobolevn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

👍

Comment thread Doc/tools/extensions/c_annotations.py Outdated
Comment thread Doc/tools/extensions/c_annotations.py Outdated

erlend-aasland left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Looks good

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
hugovk enabled auto-merge (squash) April 16, 2024 15:44
hugovk merged commit 3284b84 into python:main Apr 16, 2024
hugovk deleted the docs-c-api-return-value-classes branch April 16, 2024 15:56

Copy link
Copy Markdown

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

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Apr 16, 2024
(cherry picked from commit 3284b84)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>

bedevere-app Bot commented Apr 16, 2024

Copy link
Copy Markdown

GH-117937 is a backport of this pull request to the 3.12 branch.

bedevere-app Bot removed the needs backport to 3.12 only security fixes label Apr 16, 2024
hugovk added a commit that referenced this pull request Apr 16, 2024
#117937)

Docs: Add classes to C API return value annotations (GH-117926)
(cherry picked from commit 3284b84)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
diegorusso pushed a commit to diegorusso/cpython that referenced this pull request Apr 17, 2024

hugovk commented Apr 17, 2024

Copy link
Copy Markdown
Member Author

Step two: python/python-docs-theme#188

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir skip issue skip news

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL