Fix HTTPConnection timeout type (#3565)

`HTTPConnection` only passes timeout down to `socket.settimeout()` which is of type `Optional[float]` and has a specific action for `None`.  `HTTPConnection` should support the same behavior
This commit is contained in:
Daniel Farley
2020-01-05 07:11:22 -08:00
committed by Sebastian Rittau
parent 616b6d0f3b
commit 4fb4c80af7

View File

@@ -126,7 +126,7 @@ class _HTTPConnectionProtocol(Protocol):
) -> HTTPConnection: ...
class HTTPConnection:
timeout: float
timeout: Optional[float]
host: str
port: int
sock: Any
@@ -134,14 +134,14 @@ class HTTPConnection:
def __init__(
self,
host: str, port: Optional[int] = ...,
timeout: float = ...,
timeout: Optional[float] = ...,
source_address: Optional[Tuple[str, int]] = ..., blocksize: int = ...
) -> None: ...
else:
def __init__(
self,
host: str, port: Optional[int] = ...,
timeout: float = ...,
timeout: Optional[float] = ...,
source_address: Optional[Tuple[str, int]] = ...
) -> None: ...
if sys.version_info >= (3, 6):
@@ -174,7 +174,7 @@ class HTTPSConnection(HTTPConnection):
host: str, port: Optional[int] = ...,
key_file: Optional[str] = ...,
cert_file: Optional[str] = ...,
timeout: float = ...,
timeout: Optional[float] = ...,
source_address: Optional[Tuple[str, int]] = ...,
*, context: Optional[ssl.SSLContext] = ...,
check_hostname: Optional[bool] = ...) -> None: ...