diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2021-12-18 09:22:10 +0300 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2021-12-19 06:53:15 +0300 |
commit | e7e08d2a784d1e87aded58186bff776d6de42213 (patch) | |
tree | ecaa301d979a75d2516fe3cced73e8323f9108b9 /sphinx/pycode | |
parent | 8d0fd9e74a6d44ca1a518225d9be030d91917c9b (diff) |
Fix #9968: autodoc: ivars are not shown if __init__ has posonlyargs
Diffstat (limited to 'sphinx/pycode')
-rw-r--r-- | sphinx/pycode/parser.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sphinx/pycode/parser.py b/sphinx/pycode/parser.py index cad9a6e71..6b566c4c4 100644 --- a/sphinx/pycode/parser.py +++ b/sphinx/pycode/parser.py @@ -312,6 +312,10 @@ class VariableCommentPicker(ast.NodeVisitor): """Returns the name of the first argument if in a function.""" if self.current_function and self.current_function.args.args: return self.current_function.args.args[0] + elif (self.current_function and + getattr(self.current_function.args, 'posonlyargs', None)): + # for py38+ + return self.current_function.args.posonlyargs[0] # type: ignore else: return None |