From daea9ac7ca22e08d4f61de46e2e1a0a1ee18f542 Mon Sep 17 00:00:00 2001 From: hauntsaninja <> Date: Mon, 20 Jan 2020 20:55:26 -0600 Subject: [PATCH 1/2] io: minor fixes for arguments --- stdlib/3/io.pyi | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/stdlib/3/io.pyi b/stdlib/3/io.pyi index d835219dd92b..c1d68461c95e 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,10 @@ 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: ... + if sys.version_info >= (3, 7): + def readline(self, __size: int = ...) -> bytes: ... + else: + def readline(self, __size: Optional[int] = ...) -> bytes: ... def __del__(self) -> None: ... closed: bool # copied from BufferedIOBase @@ -111,7 +115,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: int = ...) -> bytes: ... + else: + def read1(self, __size: int) -> bytes: ... class BufferedReader(BufferedIOBase): def __init__(self, raw: RawIOBase, buffer_size: int = ...) -> None: ... From e1ad342473c314c104862431d7644d0f5ee8680f Mon Sep 17 00:00:00 2001 From: hauntsaninja <> Date: Thu, 23 Jan 2020 23:53:15 -0800 Subject: [PATCH 2/2] io: code review fixes --- stdlib/3/io.pyi | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/stdlib/3/io.pyi b/stdlib/3/io.pyi index c1d68461c95e..4a79e7b60259 100644 --- a/stdlib/3/io.pyi +++ b/stdlib/3/io.pyi @@ -103,10 +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: ... - if sys.version_info >= (3, 7): - def readline(self, __size: int = ...) -> bytes: ... - else: - def readline(self, __size: Optional[int] = ...) -> bytes: ... + def readline(self, __size: Optional[int] = ...) -> bytes: ... def __del__(self) -> None: ... closed: bool # copied from BufferedIOBase @@ -116,9 +113,9 @@ class BytesIO(BinaryIO): def readinto1(self, b: _bytearray_like) -> int: ... def read(self, size: Optional[int] = ...) -> bytes: ... if sys.version_info >= (3, 7): - def read1(self, __size: int = ...) -> bytes: ... + def read1(self, __size: Optional[int] = ...) -> bytes: ... else: - def read1(self, __size: int) -> bytes: ... + def read1(self, __size: Optional[int]) -> bytes: ... class BufferedReader(BufferedIOBase): def __init__(self, raw: RawIOBase, buffer_size: int = ...) -> None: ...