Skip to content

Incorrect use of the :class: role with the "()" suffix #120345

Closed

Description

@serhiy-storchaka

There are several uses of the :class: role with the name followed by ().

Doc/tutorial/stdlib2.rst:296:The :mod:`array` module provides an :class:`~array.array()` object that is like
Doc/tutorial/stdlib2.rst:309:The :mod:`collections` module provides a :class:`~collections.deque()` object
Doc/whatsnew/2.5.rst:1727:calling into the interpreter's code.   There's a :class:`py_object()` type
Doc/whatsnew/2.5.rst:1737:Don't forget to use :class:`py_object()`; if it's omitted you end  up with a
Doc/whatsnew/3.12.rst:742:* Add :class:`itertools.batched()` for collecting into even-sized
Doc/howto/descriptor.rst:790:object returned by :class:`super()`.
Doc/library/datetime.rst:2156:   This is called from the default :class:`datetime.astimezone()`
Doc/library/fileinput.rst:50:*openhook* parameter to :func:`fileinput.input` or :class:`FileInput()`. The
Doc/library/collections.rst:102:    Note, the iteration order of a :class:`ChainMap()` is determined by

This is incorrect. If we refer to a class as a type, we should not add () to the name. If we refer to it as a callable, we can use the :func: role instead (which adds () automatically). In one place :class: was improperly used for not a class at all.

Linked PRs

Activity

  1. added
    docsDocumentation in the Doc dir
    3.12only security fixes
    3.13only security fixes
    3.14bugs and security fixes
    on Jun 11, 2024
  2. added 2 commits that reference this issue on Jun 11, 2024
  3. added 2 commits that reference this issue on Jun 12, 2024
  4. added 2 commits that reference this issue on Jun 12, 2024
  5. hugovk commented on Jun 12, 2024

    @hugovk
    Member

    Is this something that could be suggested for https://github.com/sphinx-contrib/sphinx-lint?

    And can this issue be closed?

  6. serhiy-storchaka commented on Jun 12, 2024

    @serhiy-storchaka
    MemberAuthor

    Among more than 9000 :class: references there were only 9 with such kind of error. About 1 error in 2 years. And now they are fixed.

    If you add a check in the linter, it will run in vain two years before catching the next error.

  7. added a commit that references this issue on Jun 30, 2024
  8. added a commit that references this issue on Jul 11, 2024
  9. added a commit that references this issue on Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.12only security fixes3.13only security fixes3.14bugs and security fixesdocsDocumentation in the Doc dir

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions