From 64598e49b03947bbde3a64291501ccdf00056154 Mon Sep 17 00:00:00 2001
From: Sebastian Rittau <srittau@rittau.biz>
Date: Tue, 11 Sep 2018 11:27:53 +0200
Subject: [PATCH] Fix RawConfigParser.readfp() annotation

Closes #689
---
 stdlib/2/ConfigParser.pyi | 6 ++++--
 stdlib/3/configparser.pyi | 6 +-----
 2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/stdlib/2/ConfigParser.pyi b/stdlib/2/ConfigParser.pyi
index 203d75319824..6e6a70e1de1b 100644
--- a/stdlib/2/ConfigParser.pyi
+++ b/stdlib/2/ConfigParser.pyi
@@ -1,4 +1,4 @@
-from typing import Any, IO, Sequence, Tuple, Union, List, Dict
+from typing import Any, IO, Sequence, Tuple, Union, List, Dict, Protocol
 
 DEFAULTSECT = ...  # type: str
 MAX_INTERPOLATION_DEPTH = ...  # type: int
@@ -50,6 +50,8 @@ class MissingSectionHeaderError(ParsingError):
     line = ...  # type: Any
     def __init__(self, filename: str, lineno: Any, line: Any) -> None: ...
 
+class _Readable(Protocol):
+    def readline(self) -> str: ...
 
 class RawConfigParser:
     _dict = ...  # type: Any
@@ -66,7 +68,7 @@ class RawConfigParser:
     def has_section(self, section: str) -> bool: ...
     def options(self, section: str) -> List[str]: ...
     def read(self, filenames: Union[str, Sequence[str]]) -> List[str]: ...
-    def readfp(self, fp: IO[str], filename: str = ...) -> None: ...
+    def readfp(self, fp: _Readable, filename: str = ...) -> None: ...
     def get(self, section: str, option: str) -> str: ...
     def items(self, section: str) -> List[Tuple[Any, Any]]: ...
     def _get(self, section: str, conv: type, option: str) -> Any: ...
diff --git a/stdlib/3/configparser.pyi b/stdlib/3/configparser.pyi
index 16c063ac295d..99539b578ae6 100644
--- a/stdlib/3/configparser.pyi
+++ b/stdlib/3/configparser.pyi
@@ -92,15 +92,11 @@ class RawConfigParser(_parser):
 
     def read(self, filenames: Union[_Path, Iterable[_Path]],
              encoding: Optional[str] = ...) -> List[str]: ...
-
-    def readfp(self, fp: IO[str], filename: Optional[str] = ...) -> None: ...
-
     def read_file(self, f: Iterable[str], source: Optional[str] = ...) -> None: ...
-
     def read_string(self, string: str, source: str = ...) -> None: ...
-
     def read_dict(self, dictionary: Mapping[str, Mapping[str, Any]],
                   source: str = ...) -> None: ...
+    def readfp(self, fp: Iterable[str], filename: Optional[str] = ...) -> None: ...
 
     # These get* methods are partially applied (with the same names) in
     # SectionProxy; the stubs should be kept updated together