diff options
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': |