From 49e12206cdec56bcb064613165411f490aac9c8a Mon Sep 17 00:00:00 2001 From: Matthias Kramm Date: Fri, 28 Jul 2017 13:08:27 -0700 Subject: [PATCH 1/2] Remove subclass IOBase from TextIOBase. This used to cause TextIOBase to subclass both BinaryIO and TextIO, even though those two are incompatible. --- stdlib/2/io.pyi | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/stdlib/2/io.pyi b/stdlib/2/io.pyi index 0c01b2b15342..e78ec50687d6 100644 --- a/stdlib/2/io.pyi +++ b/stdlib/2/io.pyi @@ -39,5 +39,7 @@ class RawIOBase(_io._RawIOBase, IOBase): class BufferedIOBase(_io._BufferedIOBase, IOBase): pass -class TextIOBase(_io._TextIOBase, IOBase): # type: ignore +# Note: In the actual io.py, TextIOBase subclasses IOBase. +# (Which we don't do here because we don't want to subclass both TextIO and BinaryIO.) +class TextIOBase(_io._TextIOBase): pass From ea063e3dbaa3a96b0980e0d885063cd9aa85081c Mon Sep 17 00:00:00 2001 From: Matthias Kramm Date: Fri, 28 Jul 2017 13:11:25 -0700 Subject: [PATCH 2/2] Fix fcntl to use IO instead of IOBase. --- stdlib/2/fcntl.pyi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stdlib/2/fcntl.pyi b/stdlib/2/fcntl.pyi index 5e7da7fef7cd..c7ff895e4fdc 100644 --- a/stdlib/2/fcntl.pyi +++ b/stdlib/2/fcntl.pyi @@ -1,4 +1,4 @@ -from typing import Any, Union +from typing import Any, Union, IO import io FASYNC = ... # type: int @@ -72,7 +72,7 @@ LOCK_SH = ... # type: int LOCK_UN = ... # type: int LOCK_WRITE = ... # type: int -_ANYFILE = Union[int, io.IOBase] +_ANYFILE = Union[int, IO] # TODO All these return either int or bytes depending on the value of # cmd (not on the type of arg).