diff --git a/pyi.py b/pyi.py index 27415850..25c41553 100644 --- a/pyi.py +++ b/pyi.py @@ -2020,7 +2020,7 @@ def _check_class_method_for_bad_typevars( self._Y019_error(method, cls_typevar) def check_self_typevars(self, node: ast.FunctionDef | ast.AsyncFunctionDef) -> None: - pos_or_keyword_args = node.args.args + pos_or_keyword_args = node.args.posonlyargs + node.args.args if not pos_or_keyword_args: return diff --git a/tests/typevar.pyi b/tests/typevar.pyi index bda9876d..a8012889 100644 --- a/tests/typevar.pyi +++ b/tests/typevar.pyi @@ -42,6 +42,7 @@ class GoodClass: def __new__(cls: type[Self], *args: list[int], **kwargs: set[str]) -> Self: ... def good_instance_method_1(self: Self, arg: bytes) -> Self: ... def good_instance_method_2(self, arg1: _S2, arg2: _S2) -> _S2: ... + def good_instance_method_3(self, arg1: _S2, /, arg2: _S2) -> _S2: ... @classmethod def good_cls_method_1(cls: type[Self], arg: int) -> Self: ... @classmethod