diff --git a/stdlib/io.pyi b/stdlib/io.pyi index c362a8587..5092d0ee3 100644 --- a/stdlib/io.pyi +++ b/stdlib/io.pyi @@ -1,7 +1,8 @@ import builtins import codecs import sys -from _typeshed import ReadableBuffer, Self, WriteableBuffer +from _typeshed import ReadableBuffer, Self, StrOrBytesPath, WriteableBuffer +from os import _Opener from types import TracebackType from typing import IO, Any, BinaryIO, Callable, Iterable, Iterator, List, Optional, TextIO, Tuple, Type, Union @@ -64,14 +65,9 @@ class BufferedIOBase(IOBase): class FileIO(RawIOBase, BinaryIO): mode: str - # Technically this is whatever is passed in as file, either a str, a bytes, or an int. - name: Union[int, str] # type: ignore + name: StrOrBytesPath | int # type: ignore def __init__( - self, - file: Union[str, bytes, int], - mode: str = ..., - closefd: bool = ..., - opener: Optional[Callable[[Union[int, str], str], int]] = ..., + self, file: StrOrBytesPath | int, mode: str = ..., closefd: bool = ..., opener: _Opener | None = ... ) -> None: ... @property def closefd(self) -> bool: ...