⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content

Conversation

@ZeroIntensity
Copy link
Member

@ZeroIntensity ZeroIntensity commented Nov 16, 2025

These are all APIs that expose implementation details. Instead of truly documenting them and what they do, this PR just adds a note saying "don't use this" with no additional information. This is a good compromise for us; if someone saw these in their IDE, Python will still provide some form of documentation for them, but they won't lead to any additional maintenance burden.

cc @vstinner @encukou -- I suspect both of you will have some strong opinions here.


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

@ZeroIntensity ZeroIntensity added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes labels Nov 16, 2025
@encukou
Copy link
Member

encukou commented Nov 17, 2025

I suspect […] you will have some strong opinions here.

Yes. My opinion is that documentation for deprecated API should tell you what to do if you find it in some dusty legacy codebase.
Here that would involve PyLong_GetNativeLayout for the PyLong details; open() for stdprinter, etc.

@ZeroIntensity
Copy link
Member Author

Here that would involve PyLong_GetNativeLayout for the PyLong details; open() for stdprinter, etc.

Ok, I can do that.

I have a few ideas on how we could format this -- which do you prefer?

  1. Keep all the symbols here, just with additional documentation pointing to the alternative.
  2. The same as above, but on a dedicated page.
  3. Move them next to the rest of their friends (e.g. other PyLong* functions), but contain the soft-deprecation note and the alternative.
  4. The same as above, but a dedicated "Soft-deprecated symbols" section for every page.

@vstinner
Copy link
Member

I'm not sure that a "Soft-deprecated" section is needed.

Move them next to the rest of their friends (e.g. other PyLong* functions), but contain the soft-deprecation note and the alternative.

That sounds like a reasonable approach.

@encukou
Copy link
Member

encukou commented Nov 17, 2025

The same as above, but a dedicated "Soft-deprecated symbols" section for every page.

I'd prefer “Deprecated API” sections at the end of pages. Alas, that might not be a popular preference :(
If you're not reading top-to-bottom, the order doesn't matter that much. If you are, you can skip the section.

Move them next to the rest of their friends (e.g. other PyLong* functions), but contain the soft-deprecation note and the alternative.

That makes sense for “close friends” -- e.g. if the porting instructions tell you to use a specific other function instead.

@vstinner
Copy link
Member

I'd prefer “Deprecated API” sections at the end of pages. Alas, that might not be a popular preference :(

If others are fine with a Deprecated API section, I would also be fine with it.

@encukou
Copy link
Member

encukou commented Nov 19, 2025

See https://docs.python.org/3/c-api/unicode.html#deprecated-api for an example. I think it's working pretty well.

@vstinner
Copy link
Member

See https://docs.python.org/3/c-api/unicode.html#deprecated-api for an example. I think it's working pretty well.

It looks nice.

@ZeroIntensity
Copy link
Member Author

Updated, let me know what you think.

My opinion is that documentation for deprecated API should tell you what to do if you find it in some dusty legacy codebase.

In practice, we don't have great replacements for all of these, so I just documented some of them as "do not use". For example, what is a user supposed to do if they find PySet_MINSIZE somewhere?

ZeroIntensity and others added 2 commits November 19, 2025 13:27
Co-authored-by: Victor Stinner <[email protected]>
Co-authored-by: Petr Viktorin <[email protected]>
@encukou
Copy link
Member

encukou commented Nov 25, 2025

Looks good! Hopefully the WG vote will be just a formality.

@ZeroIntensity
Copy link
Member Author

There are a couple of APIs on the deprecation list that aren't documented here. I'll address those separately.

@ZeroIntensity ZeroIntensity merged commit 0e0d51c into python:main Jan 14, 2026
38 checks passed
@github-project-automation github-project-automation bot moved this from Todo to Done in Docs PRs Jan 14, 2026
@ZeroIntensity ZeroIntensity deleted the document-internal-symbols branch January 14, 2026 13:20
@miss-islington-app
Copy link

Thanks @ZeroIntensity for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jan 14, 2026
…1634)

(cherry picked from commit 0e0d51cdcef903d8a990c8e264f32f2f28af0673)

Co-authored-by: Peter Bierma <[email protected]>
Co-authored-by: Petr Viktorin <[email protected]>
Co-authored-by: Victor Stinner <[email protected]>
@miss-islington-app
Copy link

Sorry, @ZeroIntensity, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 0e0d51cdcef903d8a990c8e264f32f2f28af0673 3.13

@bedevere-app
Copy link

bedevere-app bot commented Jan 14, 2026

GH-143837 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.14 bugs and security fixes label Jan 14, 2026
ZeroIntensity added a commit that referenced this pull request Jan 14, 2026
…GH-143837)

gh-141004: Document several soft-deprecated C APIs (GH-141634)
(cherry picked from commit 0e0d51c)

Co-authored-by: Peter Bierma <[email protected]>
Co-authored-by: Petr Viktorin <[email protected]>
Co-authored-by: Victor Stinner <[email protected]>
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 needs backport to 3.13 bugs and security fixes skip news

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants