mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 04:34:28 +08:00
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:
committed by
Jelle Zijlstra
parent
85a788dbca
commit
258b9fb821
@@ -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).
|
||||
|
||||
Reference in New Issue
Block a user