File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -667,11 +667,17 @@ Keyword arguments in a direct metaclass call (such as the last two calls in the
667667example above) require no special handling: they are validated as part of
668668evaluating the call using the standard constructor call rules.
669669
670- Regardless of the evaluated return type of the implied metaclass call, a
671- :keyword: `class ` statement defines a class, and type checkers should evaluate the
672- type of the bound name accordingly (``type[MyClass1] `` in the example above).
673- The implied metaclass call is evaluated only for the purpose of validating
674- its arguments.
670+ Type checkers should honor the evaluated retunr type of the implied metaclass call,
671+ even if the evaluated type isn't a class::
672+
673+ class Meta(type):
674+ def __new__(cls, *args: object, **kwargs: obect) -> int:
675+ return 1
676+
677+ class MyClass6(metaclass=Meta):
678+ pass
679+
680+ assert_type(MyClass6, int)
675681
676682Type checkers may validate the implied call to :attr: `!__prepare__ `:
677683
You can’t perform that action at this time.
0 commit comments