This was reported by @Chainfire at python/mypy#19376 (comment).
This raises TypeError (see the above link for the traceback):
from typing import Type
import asyncio
import traceback
class Parent:
async def test(self) -> int:
raise NotImplementedError()
async def run(self) -> int:
return await self.test()
class ChildTypeError1(Parent):
async def test(self) -> int:
return 1
class ChildTypeError2(Parent):
async def run(self) -> int:
return await self.test()
def test(cls: Type[Parent]) -> None:
print(str(cls.__name__))
try:
print("- ", asyncio.run(cls().run()))
except NotImplementedError:
pass
except Exception:
traceback.print_exc()
exit(1)
test(ChildTypeError1)
test(ChildTypeError2)
exit(0)
This is a regression introduced in python/mypy#19376 by me.
This was reported by @Chainfire at python/mypy#19376 (comment).
This raises
TypeError(see the above link for the traceback):This is a regression introduced in python/mypy#19376 by me.