@@ -126,7 +126,8 @@ def load_v2(
126126 invdata : Inventory = {}
127127 projname = stream .readline ().rstrip ()[11 :]
128128 version = stream .readline ().rstrip ()[11 :]
129- potential_ambiguities = set ()
129+ # definition -> priority, location, display name
130+ potential_ambiguities : dict [str , tuple [str , str , str ]] = {}
130131 actual_ambiguities = set ()
131132 line = stream .readline ()
132133 if 'zlib' not in line :
@@ -155,10 +156,16 @@ def load_v2(
155156 # * 'term': https://github.com/sphinx-doc/sphinx/issues/9291
156157 # * 'label': https://github.com/sphinx-doc/sphinx/issues/12008
157158 definition = f"{ type } :{ name } "
158- if definition .lower () in potential_ambiguities :
159- actual_ambiguities .add (definition )
159+ content = prio , location , dispname
160+ lowercase_definition = definition .lower ()
161+ if lowercase_definition in potential_ambiguities :
162+ if potential_ambiguities [lowercase_definition ] != content :
163+ actual_ambiguities .add (definition )
164+ else :
165+ logger .debug (__ ("inventory <%s> contains duplicate definitions of %s" ),
166+ uri , definition , type = 'intersphinx' , subtype = 'external' )
160167 else :
161- potential_ambiguities . add ( definition . lower ())
168+ potential_ambiguities [ lowercase_definition ] = content
162169 if location .endswith ('$' ):
163170 location = location [:- 1 ] + name
164171 location = join (uri , location )
0 commit comments