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
…1398 (#11420)
Closes#11398
Now cases like
```python
from typing import Type
class MyMetaClass(type):
def __new__(cls, name, bases, attrs) -> Type['MyClass']:
pass
class MyClass(metaclass=MyMetaClass):
pass
```
will pass.
…thon#11398 (python#11420)
Closespython#11398
Now cases like
```python
from typing import Type
class MyMetaClass(type):
def __new__(cls, name, bases, attrs) -> Type['MyClass']:
pass
class MyClass(metaclass=MyMetaClass):
pass
```
will pass.
Feature
The
__new__
method of a Metaclass should be hinted as returning a specificType
.Pitch
Currently, mypy will say:
"__new__" must return a class instance (got "Type[MyAbstractClass]")
The text was updated successfully, but these errors were encountered: