From f5d4ebdb2ef15aead2af1285e32c1e7ec624ff7b Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Fri, 22 Nov 2024 17:15:18 +0000 Subject: [PATCH] Narrow the type of `ChangeSet.descname` to `str` --- sphinx/directives/__init__.py | 2 +- sphinx/domains/changeset.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sphinx/directives/__init__.py b/sphinx/directives/__init__.py index c45232c92e7..4c92af67d9d 100644 --- a/sphinx/directives/__init__.py +++ b/sphinx/directives/__init__.py @@ -296,7 +296,7 @@ def run(self) -> list[Node]: 'object-description-transform', self.domain, self.objtype, content_node ) DocFieldTransformer(self).transform_all(content_node) - self.env.temp_data['object'] = None + self.env.temp_data['object'] = '' self.after_content() if node['no-typesetting']: diff --git a/sphinx/domains/changeset.py b/sphinx/domains/changeset.py index a27c5f571a8..abf622d5bb8 100644 --- a/sphinx/domains/changeset.py +++ b/sphinx/domains/changeset.py @@ -41,7 +41,7 @@ class ChangeSet(NamedTuple): docname: str lineno: int module: str | None - descname: str | None + descname: str content: str @@ -123,7 +123,7 @@ def changesets(self) -> dict[str, list[ChangeSet]]: def note_changeset(self, node: addnodes.versionmodified) -> None: version = node['version'] module = self.env.ref_context.get('py:module') - objname = self.env.temp_data.get('object') + objname = self.env.temp_data.get('object', '') changeset = ChangeSet(node['type'], self.env.docname, node.line, # type: ignore[arg-type] module, objname, node.astext()) self.changesets.setdefault(version, []).append(changeset)