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.
This commit is contained in:
Daniel Watkins
2017-08-29 05:29:57 +01:00
committed by Jelle Zijlstra
parent 85a788dbca
commit 258b9fb821

View File

@@ -1,6 +1,6 @@
# Stubs for fcntl
from io import IOBase
from typing import Any, IO, Union
import typing
FASYNC = ... # type: int
FD_CLOEXEC = ... # type: int
@@ -75,7 +75,7 @@ LOCK_SH = ... # type: int
LOCK_UN = ... # type: int
LOCK_WRITE = ... # type: int
_AnyFile = Union[int, IO[Any]]
_AnyFile = Union[int, IO[Any], IOBase]
# TODO All these return either int or bytes depending on the value of
# cmd (not on the type of arg).