Skip to content

Commit 6f23d12

Browse files
matthiaskrammgvanrossum
authored andcommitted
Remove subclass IOBase from TextIOBase. (#1505)
This used to cause TextIOBase to subclass both BinaryIO and TextIO, even though those two are incompatible.
1 parent 2d97894 commit 6f23d12

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

stdlib/2/fcntl.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Any, Union
1+
from typing import Any, Union, IO
22
import io
33

44
FASYNC = ... # type: int
@@ -72,7 +72,7 @@ LOCK_SH = ... # type: int
7272
LOCK_UN = ... # type: int
7373
LOCK_WRITE = ... # type: int
7474

75-
_ANYFILE = Union[int, io.IOBase]
75+
_ANYFILE = Union[int, IO]
7676

7777
# TODO All these return either int or bytes depending on the value of
7878
# cmd (not on the type of arg).

stdlib/2/io.pyi

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,7 @@ class RawIOBase(_io._RawIOBase, IOBase):
3939
class BufferedIOBase(_io._BufferedIOBase, IOBase):
4040
pass
4141

42-
class TextIOBase(_io._TextIOBase, IOBase): # type: ignore
42+
# Note: In the actual io.py, TextIOBase subclasses IOBase.
43+
# (Which we don't do here because we don't want to subclass both TextIO and BinaryIO.)
44+
class TextIOBase(_io._TextIOBase):
4345
pass

0 commit comments

Comments
 (0)