Skip to content

Commit

Permalink
make http.client.HTTPResponse be a BinaryIO
Browse files Browse the repository at this point in the history
Fixes python#2189

The errors from mypy are a false positive (see python/mypy#5027).
  • Loading branch information
JelleZijlstra committed Jun 12, 2018
1 parent 978c091 commit 5d16cac
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions stdlib/3/http/client.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ from typing import (
Any, Dict, IO, Iterable, List, Iterator, Mapping, Optional, Tuple, Type, TypeVar,
Union,
overload,
BinaryIO,
)
import email.message
import io
Expand Down Expand Up @@ -79,7 +80,8 @@ responses = ... # type: Dict[int, str]
class HTTPMessage(email.message.Message): ...

if sys.version_info >= (3, 5):
class HTTPResponse(io.BufferedIOBase):
# Ignore errors to work around python/mypy#5027
class HTTPResponse(io.BufferedIOBase, BinaryIO): # type: ignore
msg = ... # type: HTTPMessage
headers = ... # type: HTTPMessage
version = ... # type: int
Expand All @@ -103,7 +105,7 @@ if sys.version_info >= (3, 5):
exc_val: Optional[BaseException],
exc_tb: Optional[types.TracebackType]) -> bool: ...
else:
class HTTPResponse:
class HTTPResponse(BinaryIO):
msg = ... # type: HTTPMessage
headers = ... # type: HTTPMessage
version = ... # type: int
Expand Down

0 comments on commit 5d16cac

Please sign in to comment.