From e253e7660d48422d3a0ea643bc1b11419fb3cddc Mon Sep 17 00:00:00 2001 From: Shantanu <12621235+hauntsaninja@users.noreply.github.com> Date: Thu, 8 Jun 2023 15:31:23 -0700 Subject: [PATCH] Fix stubtest crash in explicit init subclass (#15399) --- 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":