For the following example:
import sys, io
if isinstance(sys.stdout, io.TextIOWrapper) and sys.version_info < (3, 7):
sys.stdout = io.TextIOWrapper(
sys.stdout.detach(),
encoding="ascii",
errors="replace")
I get the following error:
reconfigure36.py:5: error: Argument 1 to "TextIOWrapper" has incompatible type "IOBase"; expected "IO[bytes]"
Should not TextIOWrapper.detach() return IO[bytes] instead of IOBase?
Replacing sys.stdout.detach() with sys.stdout.buffer fixes the complains.
For the following example:
I get the following error:
Should not
TextIOWrapper.detach()returnIO[bytes]instead ofIOBase?Replacing
sys.stdout.detach()withsys.stdout.bufferfixes the complains.