diff --git a/CHANGES b/CHANGES index b48ee5e75..d15580368 100644 --- a/CHANGES +++ b/CHANGES @@ -32,6 +32,7 @@ Bugs fixed classes attribute refers missing citation (refs: #6147) * #2155: Support ``code`` directive * C++, fix parsing of braced initializers. +* #6172: AttributeError is raised for old styled index nodes Testing -------- diff --git a/sphinx/util/compat.py b/sphinx/util/compat.py index 1567bad9e..5d8cbb3db 100644 --- a/sphinx/util/compat.py +++ b/sphinx/util/compat.py @@ -58,12 +58,12 @@ class IndexEntriesMigrator(SphinxTransform): def apply(self, **kwargs): # type: (Any) -> None for node in self.document.traverse(addnodes.index): - for entries in node['entries']: + for i, entries in enumerate(node['entries']): if len(entries) == 4: source, line = get_source_line(node) warnings.warn('An old styled index node found: %r at (%s:%s)' % (node, source, line), RemovedInSphinx40Warning) - entries.extend([None]) + node['entries'][i] = entries + (None,) def setup(app):