Commits

Georg Brandl committed 64834d7

Closes #1159: do not emit duplicate inventory entries for py:module objects.

Also add a workaround on the consumer side in intersphinx, so that links
to projects using old versions of Sphinx generate correct links.

  • Participants
  • Parent commits 1b29ab8

Comments (0)

Files changed (2)

File sphinx/domains/python.py

         for modname, info in self.data['modules'].iteritems():
             yield (modname, modname, 'module', info[0], 'module-' + modname, 0)
         for refname, (docname, type) in self.data['objects'].iteritems():
-            yield (refname, refname, type, docname, refname, 1)
+            if type != 'module':  # modules are already handled
+                yield (refname, refname, type, docname, refname, 1)

File sphinx/ext/intersphinx.py

         if not m:
             continue
         name, type, prio, location, dispname = m.groups()
+        if type == 'py:module' and type in invdata and \
+            name in invdata[type]:  # due to a bug in 1.1 and below,
+                                    # two inventory entries are created
+                                    # for Python modules, and the first
+                                    # one is correct
+            continue
         if location.endswith(u'$'):
             location = location[:-1] + name
         location = join(uri, location)