From 33f1cfd45dc9c2ac34d44935a012c39c661c303b Mon Sep 17 00:00:00 2001 From: hauntsaninja Date: Thu, 8 Jun 2023 14:52:52 -0700 Subject: [PATCH] Fix stubtest crash in explicit init subclass --- mypy/stubtest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mypy/stubtest.py b/mypy/stubtest.py index 4e038cfd75d1..a55be41d1a5d 100644 --- a/mypy/stubtest.py +++ b/mypy/stubtest.py @@ -668,7 +668,7 @@ def _verify_arg_default_value( def maybe_strip_cls(name: str, args: list[nodes.Argument]) -> list[nodes.Argument]: - if name in ("__init_subclass__", "__class_getitem__"): + if args and name in ("__init_subclass__", "__class_getitem__"): # These are implicitly classmethods. If the stub chooses not to have @classmethod, we # should remove the cls argument if args[0].variable.name == "cls":