Fix #6436: napoleon: "Unknown target name" error

This commit is contained in:
Takeshi KOMIYA 2019-06-09 00:23:18 +09:00
parent f0b1cbb734
commit c4dfc7402e
3 changed files with 7 additions and 2 deletions

View File

@ -20,6 +20,8 @@ Bugs fixed
immediately preceding section title by pagebreak
* #6448: autodoc: crashed when autodocumenting classes with ``__slots__ = None``
* #6452: autosummary: crashed when generating document of properties
* #6436: napoleon: "Unknown target name" error if variable name ends with
underscore
Testing
--------

View File

@ -328,6 +328,9 @@ class GoogleDocstring:
def _escape_args_and_kwargs(self, name):
# type: (str) -> str
if name.endswith('_'):
name = name[:-1] + r'\_'
if name[:2] == '**':
return r'\*\*' + name[2:]
elif name[:1] == '*':

View File

@ -1351,8 +1351,8 @@ arg_ : type
"""
expected = """
:ivar arg_: some description
:vartype arg_: type
:ivar arg\\_: some description
:vartype arg\\_: type
"""
config = Config(napoleon_use_ivar=True)