ITADN

[9 regression] WARNING: more than one target found for cross-reference 'type'

#14548ClosedDreamsorcerer 创建于 2026-07-21
type:bugextensions:autodoc
D
Dreamsorcerercommented
### Describe the bug When two documented classes each have an attribute named type, a bare type (the builtin) elsewhere in a rendered annotation resolves ambiguously to those attributes instead of the Python builtin. Actual (9.1.0): WARNING: more than one target found for cross-reference 'type': bug.ImageMsg.type, bug.StreamRef.type [ref.python] Expected (8.2.3, clean): bare type resolves to the builtin; documented .type attributes are not candidates for an unqualified type reference. ### How to Reproduce bug.py ``` class StreamRef: """A ref.""" type: type """The stream type.""" class ImageMsg: """A message.""" type: str """The image type.""" def make(pairs: tuple[str, type]) -> None: """Build from (name, type) pairs.""" ``` conf.py ``` import os, sys; sys.path.insert(0, os.path.abspath(".")) extensions = ["sphinx.ext.autodoc"] nitpicky = True autodoc_default_options = {"members": True, "undoc-members": True} autodoc_typehints = "signature" ``` rst ``` .. automodule:: bug ``` Run ``` sphinx-build -b html -n . _out ``` ### Environment Information ```text Platform: darwin Python: 3.12 Sphinx: 9.1.0 (issue not present in 8.x) Docutils: 0.21.2 Jinja2: 3.1.6 Pygments: 2.19.2 ``` ### Sphinx extensions ```python ``` ### Additional context _No response_
关闭于 22 天前 4 条评论