diff options
Diffstat (limited to 'pylint/checkers/classes.py')
-rw-r--r-- | pylint/checkers/classes.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/pylint/checkers/classes.py b/pylint/checkers/classes.py index 986809fd3..9f5d09943 100644 --- a/pylint/checkers/classes.py +++ b/pylint/checkers/classes.py @@ -1460,7 +1460,12 @@ a metaclass class method.", # don't care about functions with unknown argument (builtins) if node.args.args is None: return - first_arg = node.args.args and node.argnames()[0] + if node.args.args: + first_arg = node.argnames()[0] + elif node.args.posonlyargs: + first_arg = node.args.posonlyargs[0].name + else: + first_arg = None self._first_attrs.append(first_arg) first = self._first_attrs[-1] # static method @@ -1474,7 +1479,7 @@ a metaclass class method.", return self._first_attrs[-1] = None # class / regular method with no args - elif not node.args.args: + elif not node.args.args and not node.args.posonlyargs: self.add_message("no-method-argument", node=node) # metaclass elif metaclass: |