Closed
Description
Bug report
When collections.deque
is subclassed and the resulting class is documented with Sphinx using the option :inherited-members:
, the following error appears:
WARNING: py:class reference target not found: integer -- return number of occurrences of value
I assume this is because the PyDoc_STRVAR
docstring of the C-implementation is not compliant to PEP-7 as required in PyDoc_STRVAR
:
cpython/Modules/_collectionsmodule.c
Lines 992 to 993 in d9dff4c
And everything after ->
is interpreted as type hint.
This can be reproduced with e.g. a python module sub_deque.py
:
class SubDeque(deque):
pass
and a documenation file docs/src/sub_deque.rst
:
.. automodule:: sub_deque
:inherited-members:
which is then built with Sphinx: sphinx-build -W docs/src docs/dist
.
I'd be happy to provide a patch for this myself if you feel this issue should be fixed.
Your environment
- CPython versions tested on: 3.7 - 3.11
- Operating system and architecture: Arch Linux & Ubuntu
Linked PRs
- gh-100989: Fix docstrings of
collections.deque
#100990 - [3.11] gh-100989: Improve the accuracy of collections.deque docstrings (GH-100990) #102910
- [3.10] gh-100989: Improve the accuracy of collections.deque docstrings (GH-100990) #102911
- gh-100989: Revert #100990: Improve the accuracy of collections.deque docstrings #102949
- GH-100989: Revert Improve the accuracy of collections.deque docstrings #102979
- [3.11] GH-100989: Revert Improve the accuracy of collections.deque docstrings (GH-102979) #102984
- [3.10] GH-100989: Revert Improve the accuracy of collections.deque docstrings (GH-102979) #102985
- GH-100989: remove annotation from docstring #102991
- [3.11] GH-100989: remove annotation from docstring (GH-102991) #102992