summaryrefslogtreecommitdiff
path: root/sphinx/pycode/parser.py
diff options
context:
space:
mode:
Diffstat (limited to 'sphinx/pycode/parser.py')
-rw-r--r--sphinx/pycode/parser.py4
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