You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The implicit xrefs created by the info fields :type: and :rtype: seems to do lookup differently than explicit xref roles. For unqualified names it seems like they search for the name in every (sub)module instead of in the current module and then parent modules.
index.rst:28: WARNING: more than one target found for cross-reference 'A': mod.A, mod.submod.A
index.rst:28: WARNING: more than one target found for cross-reference 'A': mod.A, mod.submod.A
index.rst:43: WARNING: more than one target found for cross-reference 'A': mod.A, mod.submod.A
index.rst:43: WARNING: more than one target found for cross-reference 'A': mod.A, mod.submod.A
which refer to the 4 unqualified type names A.
The :param: annotated with BUG as well as the corresponding rtype gets resolved to mod.A.
Expected behavior
No warnings, and the two mentioned types should resolve to mod.submod.A.
Environment info
Sphinx version: tested both with v3.3 and with master
The text was updated successfully, but these errors were encountered:
The other side of this issue is that you can also get a silently wrong cross-reference where a warning should have been issued instead: in some module, make a class, and then make one of these cross-references in non-module scope.
tk0miya
added a commit
to tk0miya/sphinx
that referenced
this issue
Dec 19, 2020
…ous warnings
The searching context like py:module and py:class are missing in the
pending_xref nodes generated from info-field-lists. This sets these
searching context info to them.
Describe the bug
The implicit xrefs created by the info fields
:type:
and:rtype:
seems to do lookup differently than explicit xref roles. For unqualified names it seems like they search for the name in every (sub)module instead of in the current module and then parent modules.To Reproduce
gives the warnings
which refer to the 4 unqualified type names
A
.The
:param:
annotated withBUG
as well as the correspondingrtype
gets resolved tomod.A
.Expected behavior
No warnings, and the two mentioned types should resolve to
mod.submod.A
.Environment info
The text was updated successfully, but these errors were encountered: