Skip to content

Commit

Permalink
Add IOBase to types fcntl will accept as files (#1556)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
OddBloke authored and JelleZijlstra committed Aug 29, 2017
1 parent 85a788d commit 258b9fb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions stdlib/3/fcntl.pyi
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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).
Expand Down

0 comments on commit 258b9fb

Please sign in to comment.