From d5851eca6f448b648e1a7b3f3010cc3dde498535 Mon Sep 17 00:00:00 2001 From: Shantanu Date: Fri, 24 Jan 2020 00:22:19 -0800 Subject: [PATCH] io: minor fixes for arguments (#3642) --- stdlib/3/io.pyi | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/stdlib/3/io.pyi b/stdlib/3/io.pyi index d835219dd..4a79e7b60 100644 --- a/stdlib/3/io.pyi +++ b/stdlib/3/io.pyi @@ -3,6 +3,7 @@ from typing import ( ) import builtins import codecs +import sys from mmap import mmap from types import TracebackType from typing import TypeVar @@ -102,7 +103,7 @@ class BytesIO(BinaryIO): # TODO should be the next line instead # def writelines(self, lines: List[Union[bytes, bytearray]]) -> None: ... def writelines(self, lines: Any) -> None: ... - def readline(self, size: int = ...) -> bytes: ... + def readline(self, __size: Optional[int] = ...) -> bytes: ... def __del__(self) -> None: ... closed: bool # copied from BufferedIOBase @@ -111,7 +112,10 @@ class BytesIO(BinaryIO): def write(self, b: Union[bytes, bytearray]) -> int: ... def readinto1(self, b: _bytearray_like) -> int: ... def read(self, size: Optional[int] = ...) -> bytes: ... - def read1(self, size: int = ...) -> bytes: ... + if sys.version_info >= (3, 7): + def read1(self, __size: Optional[int] = ...) -> bytes: ... + else: + def read1(self, __size: Optional[int]) -> bytes: ... class BufferedReader(BufferedIOBase): def __init__(self, raw: RawIOBase, buffer_size: int = ...) -> None: ...