From 258b9fb8214cb2f2d1815b065b09b599b29e9450 Mon Sep 17 00:00:00 2001 From: Daniel Watkins Date: Tue, 29 Aug 2017 05:29:57 +0100 Subject: [PATCH] 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. --- stdlib/3/fcntl.pyi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stdlib/3/fcntl.pyi b/stdlib/3/fcntl.pyi index a50fa0d87..1ff20d60d 100644 --- a/stdlib/3/fcntl.pyi +++ b/stdlib/3/fcntl.pyi @@ -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).