From 2fdb894e15f8f3abb88523fe1e7f516f4df92ebb Mon Sep 17 00:00:00 2001 From: Daniel Watkins Date: Wed, 16 Aug 2017 21:30:13 -0400 Subject: [PATCH 1/3] Remove unused typing import from stdlib/3/fcntl.pyi --- stdlib/3/fcntl.pyi | 1 - 1 file changed, 1 deletion(-) diff --git a/stdlib/3/fcntl.pyi b/stdlib/3/fcntl.pyi index a50fa0d87e5c..418820cf7e84 100644 --- a/stdlib/3/fcntl.pyi +++ b/stdlib/3/fcntl.pyi @@ -1,6 +1,5 @@ # Stubs for fcntl from typing import Any, IO, Union -import typing FASYNC = ... # type: int FD_CLOEXEC = ... # type: int From 9996a17ea31754cba4c95ac8fbdabdb06f3e1e27 Mon Sep 17 00:00:00 2001 From: Daniel Watkins Date: Wed, 16 Aug 2017 21:30:35 -0400 Subject: [PATCH 2/3] 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 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stdlib/3/fcntl.pyi b/stdlib/3/fcntl.pyi index 418820cf7e84..bba117bda6d6 100644 --- a/stdlib/3/fcntl.pyi +++ b/stdlib/3/fcntl.pyi @@ -1,4 +1,5 @@ # Stubs for fcntl +from io import IOBase as _IOBase from typing import Any, IO, Union FASYNC = ... # type: int @@ -74,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). From cce4a2128d8c505b3d2f3bdf6da96758ad286a22 Mon Sep 17 00:00:00 2001 From: Daniel Watkins Date: Thu, 17 Aug 2017 15:22:32 -0400 Subject: [PATCH 3/3] Fix style comment on PR --- 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 bba117bda6d6..1ff20d60d7c6 100644 --- a/stdlib/3/fcntl.pyi +++ b/stdlib/3/fcntl.pyi @@ -1,5 +1,5 @@ # Stubs for fcntl -from io import IOBase as _IOBase +from io import IOBase from typing import Any, IO, Union FASYNC = ... # type: int @@ -75,7 +75,7 @@ LOCK_SH = ... # type: int LOCK_UN = ... # type: int LOCK_WRITE = ... # type: int -_AnyFile = Union[int, IO[Any], _IOBase] +_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).