diff options
| author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2021-12-18 15:22:10 +0900 |
|---|---|---|
| committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2021-12-19 12:53:15 +0900 |
| commit | e7e08d2a784d1e87aded58186bff776d6de42213 (patch) | |
| tree | ecaa301d979a75d2516fe3cced73e8323f9108b9 /sphinx/pycode/parser.py | |
| parent | 8d0fd9e74a6d44ca1a518225d9be030d91917c9b (diff) | |
| download | sphinx-git-e7e08d2a784d1e87aded58186bff776d6de42213.tar.gz | |
Fix #9968: autodoc: ivars are not shown if __init__ has posonlyargs
Diffstat (limited to 'sphinx/pycode/parser.py')
| -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 |
