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

METH_* and Py_TPFLAGS* constants are documented as Python data #96996

Closed
encukou opened this issue Sep 21, 2022 · 7 comments
Closed

METH_* and Py_TPFLAGS* constants are documented as Python data #96996

encukou opened this issue Sep 21, 2022 · 7 comments
Assignees
Labels
docs Documentation in the Doc dir

Comments

@encukou
Copy link
Member

encukou commented Sep 21, 2022

For example, a search for Py_TPFLAGS says it's all “Python data”:

image

Same with METH_.

I guess this should be changed to c:macro:. It doesn't change URLs, but it would break references and Intersphinx links in third-party docs.
And there's a lot of references to these items that use :const: rather than :c:macro:. All of them would need to change, possibly causing conflicts in backports.


An additional issue is flag combinations in structures.rst:

.. data:: METH_VARARGS

   This is the typical calling convention, where[...]


.. data:: METH_VARARGS | METH_KEYWORDS

   Methods with these flags must [...]

These should look like items of the same category to the reader, but one is a valid c:macro and the other isn't.

Sphinx experts, any tips on how (and whether) to best fix this?

@encukou encukou added the docs Documentation in the Doc dir label Sep 21, 2022
@CAM-Gerlach
Copy link
Member

CAM-Gerlach commented Sep 26, 2022

Sphinx experts, any tips on how (and whether) to best fix this?

@AA-Turner is one of the most knowledgeable people on these changes, since he was the one to propose a related set of them in #93738 that have similar effects. This ultimately seems to be more of a strict defect in the CPython docs source than that, though, as the objects are currently not categorized correctly.

As mentioned during the meeting, external links should still work, as the anchors should still be the same. Internal references will need to be updated, and unfortunately I'm not aware of any obvious mechanism to redirect old references (particularly for Intersphinx users, since internal uses can fairly easily update)— @AA-Turner , is there any chance of something like that? However, as long as they are using -n in their builds as they should be, it will let them know exactly what and where they need to update, and it will be a one-time change to fix what would otherwise be an enduring and potentially confusing defect (especially if they are migrated directly to the modern C syntax), so at least to me it seems worthwhile in the long run.

Regarding backporting, not doing so would lead to more conflicts over time and would mean existing docs would not benefit from this defect fix, but on the other hand, not backporting to at least 3.10 would minimize any backward compat concerns (since there are many other changes users expect and need to adapt to between Python docs versions anyway).

@AA-Turner
Copy link
Member

There's no way I'm aware of to mitigate this within Sphinx, I think we may just have to bite the bullet and make the changes--best time to plant a tree and all that.

We should though socialise that we are making these changes -- discussion in various documentation fora at the very least.

A

@encukou
Copy link
Member Author

encukou commented Oct 5, 2022

FWIW, a similar issue is: #97908 (Docs for some C struct members repeat the struct name)

@CAM-Gerlach
Copy link
Member

CAM-Gerlach commented Oct 5, 2022

FWIW, since this appears it will only break Intersphinx references, it produces a warning (with -n) and will visibly not resolve as a link in the rendered docs, so there will be some visibility already there whenever it happens, without people having to update their docs manually.

@CAM-Gerlach
Copy link
Member

To note, in that issue the fragments visible to external links will change, unless we add ref target labels with the old name.

@encukou
Copy link
Member Author

encukou commented Aug 2, 2023

#106919 fixed this, without preserving the URL fragments and external intersphinx references or advertising the changes.
I currently don't have bandwith to do those. If I (or someone else) don't find time by 3.11.0, we'll need to live with it.

@erlend-aasland
Copy link
Contributor

If I (or someone else) don't find time by 3.11.0, we'll need to live with it.

Both 3.11.0 and 3.12.0 have been released; seems we had to live without those advertisements. AFAIK, we did not advertise other similar Sphinx markup corrections. Suggesting to close this.

@encukou encukou closed this as completed Jan 15, 2024
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
Projects
None yet
Development

No branches or pull requests

4 participants