@@ -126,7 +126,8 @@ def load_v2(
126
126
invdata : Inventory = {}
127
127
projname = stream .readline ().rstrip ()[11 :]
128
128
version = stream .readline ().rstrip ()[11 :]
129
- potential_ambiguities = set ()
129
+ # definition -> priority, location, display name
130
+ potential_ambiguities : dict [str , tuple [str , str , str ]] = {}
130
131
actual_ambiguities = set ()
131
132
line = stream .readline ()
132
133
if 'zlib' not in line :
@@ -155,10 +156,16 @@ def load_v2(
155
156
# * 'term': https://github.com/sphinx-doc/sphinx/issues/9291
156
157
# * 'label': https://github.com/sphinx-doc/sphinx/issues/12008
157
158
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' )
160
167
else :
161
- potential_ambiguities . add ( definition . lower ())
168
+ potential_ambiguities [ lowercase_definition ] = content
162
169
if location .endswith ('$' ):
163
170
location = location [:- 1 ] + name
164
171
location = join (uri , location )
0 commit comments