[issue42512] Confusing that BinaryIO and IO[bytes] cannot be used interchangeably

2020-11-30 Thread conchylicultor
Change by conchylicultor : -- components: +Library (Lib) type: -> behavior versions: +Python 3.10 ___ Python tracker ___ ___ Python

[issue42512] Confusing that BinaryIO and IO[bytes] cannot be used interchangeably

2020-11-30 Thread conchylicultor
New submission from conchylicultor : Currently, because `BinaryIO` is subclass of `IO[bytes]`, the 2 cannot be used interchangeably. Example with pytype: ``` def iter_zip(arch_f) -> List[typing.BinaryIO]]: with open(arch_f, 'rb') as fobj: z = zipfile.ZipFile(fobj) return [z.open(mem