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 <zack@redhat.com>
Co-authored-by: Zack Cerza <zack@redhat.com>
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
This commit is contained in:
Zack Cerza 2023-08-20 16:33:36 -06:00 committed by GitHub
parent 5d929d9778
commit 1e16f21019
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 5 deletions

View File

@ -4,6 +4,7 @@ Release 7.2.3 (in development)
Bugs fixed
----------
* Fix regression in ``autodoc.Documenter.parse_name()``.
Release 7.2.2 (released Aug 17, 2023)
=====================================

View File

@ -383,14 +383,12 @@ class Documenter:
# first, parse the definition -- auto directives for classes and
# functions can contain a signature which is then used instead of
# an autogenerated one
try:
matched = py_ext_sig_re.match(self.name)
assert matched is not None
explicit_modname, path, base, tp_list, args, retann = matched.groups()
except AttributeError:
matched = py_ext_sig_re.match(self.name)
if matched is None:
logger.warning(__('invalid signature for auto%s (%r)') % (self.objtype, self.name),
type='autodoc')
return False
explicit_modname, path, base, tp_list, args, retann = matched.groups()
# support explicit module and class name separation via ::
if explicit_modname is not None: