diff --git a/sphinx/builders/changes.py b/sphinx/builders/changes.py index 918ed3bcaee..49cab2c7a8c 100644 --- a/sphinx/builders/changes.py +++ b/sphinx/builders/changes.py @@ -61,10 +61,7 @@ def write_documents(self, _docnames: Set[str]) -> None: return logger.info(bold(__('writing summary file...'))) for changeset in changesets: - if isinstance(changeset.descname, tuple): - descname = changeset.descname[0] - else: - descname = changeset.descname + descname = changeset.descname ttext = self.typemap[changeset.type] context = changeset.content.replace('\n', ' ') if descname and changeset.docname.startswith('c-api'): diff --git a/sphinx/directives/__init__.py b/sphinx/directives/__init__.py index 181c6f81a07..c45232c92e7 100644 --- a/sphinx/directives/__init__.py +++ b/sphinx/directives/__init__.py @@ -282,7 +282,11 @@ def run(self) -> list[Node]: if self.names: # needed for association of version{added,changed} directives - self.env.temp_data['object'] = self.names[0] + object_name: ObjDescT = self.names[0] + if isinstance(object_name, tuple): + self.env.temp_data['object'] = str(object_name[0]) + else: + self.env.temp_data['object'] = str(object_name) self.before_content() content_children = self.parse_content_to_nodes(allow_section_headings=True) content_node = addnodes.desc_content('', *content_children)