Skip to content

Commit 258b9fb

Browse files
OddBlokeJelleZijlstra
authored andcommitted
Add IOBase to types fcntl will accept as files (#1556)
* Remove unused typing import from stdlib/3/fcntl.pyi * Add IOBase to types fcntl will accept as files Anything that implements a fileno() method is acceptable (per https://github.com/python/cpython/blob/master/Objects/fileobject.c#L168-L173), and IOBase fits the bill. Fixes #1548.
1 parent 85a788d commit 258b9fb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

stdlib/3/fcntl.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Stubs for fcntl
2+
from io import IOBase
23
from typing import Any, IO, Union
3-
import typing
44

55
FASYNC = ... # type: int
66
FD_CLOEXEC = ... # type: int
@@ -75,7 +75,7 @@ LOCK_SH = ... # type: int
7575
LOCK_UN = ... # type: int
7676
LOCK_WRITE = ... # type: int
7777

78-
_AnyFile = Union[int, IO[Any]]
78+
_AnyFile = Union[int, IO[Any], IOBase]
7979

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

0 commit comments

Comments
 (0)