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

gh-101100: [docs] Fix Sphinx warnings in dis module #102597

Closed
wants to merge 3 commits into from

Conversation

sobolevn
Copy link
Member

@sobolevn sobolevn commented Mar 11, 2023

Original errors:

./cpython/Doc/library/dis.rst:46: WARNING: py:func reference target not found: myfunc
./cpython/Doc/library/dis.rst:51: WARNING: py:func reference target not found: myfunc
./cpython/Doc/library/dis.rst:795: WARNING: py:func reference target not found: builtins.__build_class__
./cpython/Doc/library/dis.rst:852: WARNING: py:attr reference target not found: co_names
./cpython/Doc/library/dis.rst:859: WARNING: py:attr reference target not found: co_names
./cpython/Doc/library/dis.rst:898: WARNING: py:attr reference target not found: co_names
./cpython/Doc/library/dis.rst:907: WARNING: py:attr reference target not found: co_names
./cpython/Doc/library/dis.rst:1426: WARNING: c:func reference target not found: PyObject_Format

A couple of notes for reviewers:

  1. :func:myfunc was rendered incorrectly (invalid signature):

    Снимок экрана 2023-03-11 в 12 02 24

    Because :func: is reserved for functions defined with .. function:: directive.

  2. I've silenced !builtins.__build_class__ reference, because as far as I understand, there's no desire in documenting this feature. So, now this reference renders the same way, but just does not error out

  3. :attr:!codeobject.* are also just ignoring warnings, because right now there's no way to address these attributes documented here: https://github.com/python/cpython/blame/5ffdaf748d98da6065158534720f1996a45a0072/Doc/reference/datamodel.rst#L956 So, we just add an ignore and slightly more context

  4. PyObject_Format will be found after gh-102595: Document PyObject_Format c-api function #102596 is merged

Copy link
Member

@CAM-Gerlach CAM-Gerlach left a comment

Choose a reason for hiding this comment

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

Seems otherwise good overall, but instead of disabling resolution and silencing the warnings, could co_names be properly documented instead, just like codeobject.co_positions currently is, especially since it's referenced nearly a dozen times in this document?

@sobolevn
Copy link
Member Author

sobolevn commented Mar 11, 2023

I don't know enough about the history of these fields. They might be not documented on purpose. We need a field expert here to decide.

@sobolevn sobolevn requested a review from iritkatriel March 25, 2023 07:45
@sobolevn
Copy link
Member Author

@iritkatriel can you please take a look? :)

@JelleZijlstra JelleZijlstra self-requested a review May 7, 2023 02:07
@JelleZijlstra JelleZijlstra added the needs backport to 3.11 only security fixes label May 7, 2023
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.

A comment on the pre-fixing of codeobject. -- I think we should revert this for now.

It may also be better to add an entry to nitpick_ignore in conf.py with an explanatory note rather than supressing these warnings, if we intend to document the code object attributes at a later date.

Doc/library/dis.rst Outdated Show resolved Hide resolved
@hugovk
Copy link
Member

hugovk commented May 8, 2023

if we intend to document the code object attributes at a later date.

Or can we do it now?

@JelleZijlstra JelleZijlstra removed their request for review June 7, 2023 00:49
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
@sobolevn
Copy link
Member Author

sobolevn commented Aug 25, 2023

Closed by #108476 by @erlend-aasland

@sobolevn sobolevn closed this Aug 25, 2023
@erlend-aasland
Copy link
Contributor

Sorry, @sobolevn, I didn't know you had a PR open :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting merge docs Documentation in the Doc dir needs backport to 3.11 only security fixes skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants