Skip to content

Commit 1e16f21

Browse files
zmcAA-Turner
andauthored
Fix regression in autodoc.Documenter.parse_name (#11613)
If the assert statement added in GH-11523 fails, the build fails and the user only sees ``assert matched is not None``. With this change, the user gets a proper warning message containing the name of the offending module, and the build will succeed. Signed-off-by: Zack Cerza <[email protected]> Co-authored-by: Zack Cerza <[email protected]> Co-authored-by: Adam Turner <[email protected]>
1 parent 5d929d9 commit 1e16f21

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

CHANGES

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Release 7.2.3 (in development)
44
Bugs fixed
55
----------
66

7+
* Fix regression in ``autodoc.Documenter.parse_name()``.
78

89
Release 7.2.2 (released Aug 17, 2023)
910
=====================================

sphinx/ext/autodoc/__init__.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -383,14 +383,12 @@ def parse_name(self) -> bool:
383383
# first, parse the definition -- auto directives for classes and
384384
# functions can contain a signature which is then used instead of
385385
# an autogenerated one
386-
try:
387-
matched = py_ext_sig_re.match(self.name)
388-
assert matched is not None
389-
explicit_modname, path, base, tp_list, args, retann = matched.groups()
390-
except AttributeError:
386+
matched = py_ext_sig_re.match(self.name)
387+
if matched is None:
391388
logger.warning(__('invalid signature for auto%s (%r)') % (self.objtype, self.name),
392389
type='autodoc')
393390
return False
391+
explicit_modname, path, base, tp_list, args, retann = matched.groups()
394392

395393
# support explicit module and class name separation via ::
396394
if explicit_modname is not None:

0 commit comments

Comments
 (0)