diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2021-05-11 02:35:15 +0900 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2021-05-11 02:35:15 +0900 |
commit | 71e732014ffe5a58a0c52ac16c948ef13d99d19d (patch) | |
tree | 9c8cf9a89bf703950f2902f7f12e8f372ba14dd8 /sphinx/domains/python.py | |
parent | a02d2441e2a61381fc8f8c4e24c49c7c0cf8785d (diff) | |
parent | d627a5fe842e19c469b45ad74e47639d1b8ee390 (diff) | |
download | sphinx-git-71e732014ffe5a58a0c52ac16c948ef13d99d19d.tar.gz |
Merge branch '4.0.x' into 4.x
Diffstat (limited to 'sphinx/domains/python.py')
-rw-r--r-- | sphinx/domains/python.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/sphinx/domains/python.py b/sphinx/domains/python.py index dbe2c87ca..7d39d80ed 100644 --- a/sphinx/domains/python.py +++ b/sphinx/domains/python.py @@ -1269,9 +1269,13 @@ class PythonDomain(Domain): if not matches: return None elif len(matches) > 1: - logger.warning(__('more than one target found for cross-reference %r: %s'), - target, ', '.join(match[0] for match in matches), - type='ref', subtype='python', location=node) + canonicals = [m for m in matches if not m[1].aliased] + if len(canonicals) == 1: + matches = canonicals + else: + logger.warning(__('more than one target found for cross-reference %r: %s'), + target, ', '.join(match[0] for match in matches), + type='ref', subtype='python', location=node) name, obj = matches[0] if obj[2] == 'module': |