mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
py domain: Ignore aliases for resolving :any: cross-references (#10089)
Co-authored-by: Joachim Jablon <joachim.jablon@people-doc.com>
This commit is contained in:
2
CHANGES
2
CHANGES
@@ -37,6 +37,8 @@ Bugs fixed
|
|||||||
* #8686: LaTeX: Text can fall out of code-block at end of page and leave artifact
|
* #8686: LaTeX: Text can fall out of code-block at end of page and leave artifact
|
||||||
on next page
|
on next page
|
||||||
* #10579: i18n: UnboundLocalError is raised on translating raw directive
|
* #10579: i18n: UnboundLocalError is raised on translating raw directive
|
||||||
|
* #9577, #10088: py domain: Fix warning for duplicate Python references when
|
||||||
|
using ``:any:`` and autodoc.
|
||||||
|
|
||||||
Testing
|
Testing
|
||||||
--------
|
--------
|
||||||
|
|||||||
@@ -1365,7 +1365,14 @@ class PythonDomain(Domain):
|
|||||||
|
|
||||||
# always search in "refspecific" mode with the :any: role
|
# always search in "refspecific" mode with the :any: role
|
||||||
matches = self.find_obj(env, modname, clsname, target, None, 1)
|
matches = self.find_obj(env, modname, clsname, target, None, 1)
|
||||||
|
multiple_matches = len(matches) > 1
|
||||||
|
|
||||||
for name, obj in matches:
|
for name, obj in matches:
|
||||||
|
|
||||||
|
if multiple_matches and obj.aliased:
|
||||||
|
# Skip duplicated matches
|
||||||
|
continue
|
||||||
|
|
||||||
if obj[2] == 'module':
|
if obj[2] == 'module':
|
||||||
results.append(('py:mod',
|
results.append(('py:mod',
|
||||||
self._make_module_refnode(builder, fromdocname,
|
self._make_module_refnode(builder, fromdocname,
|
||||||
|
|||||||
@@ -2,6 +2,9 @@ caninical
|
|||||||
=========
|
=========
|
||||||
|
|
||||||
:py:class:`.Foo`
|
:py:class:`.Foo`
|
||||||
|
:any:`Foo`
|
||||||
|
:any:`module.Foo`
|
||||||
|
:any:`original.module.Foo`
|
||||||
|
|
||||||
.. py:module:: canonical
|
.. py:module:: canonical
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user