You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Segfault / RecursionError when calling an instance whose class declares __call__ as an attribute of its own type #22361
mypy crashes when an instance is called and its class declares __call__ as an attribute annotated with the class itself, a Self union, or C | None. Declaring the class is fine. The crash happens on the call expression. Compiled wheels segfault, and a pure-Python build raises RecursionError.
Possibly related to the closed callable-protocol-with-Self crashes (#17314, #16877), though those used protocols with a __call__ method.
Traceback
On master (pure Python):
case.py:5: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
...
File ".../mypy/expandtype.py", line 654, in expand_self_typereturn expand_type(typ, {var.info.self_type.id: replacement})
File ".../mypy/expandtype.py", line 74, in expand_typereturn typ.accept(ExpandTypeVisitor(env, normalize_callables))
RecursionError: maximum recursion depth exceeded
Compiled wheels (2.4.0, 2.4.1) print no traceback and exit with Segmentation fault (exit code 139).
Activity