From 4fb4c80af7e53f9ea0617de5f413aba9c18cea3a Mon Sep 17 00:00:00 2001 From: Daniel Farley Date: Sun, 5 Jan 2020 07:11:22 -0800 Subject: [PATCH] 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 --- stdlib/3/http/client.pyi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/stdlib/3/http/client.pyi b/stdlib/3/http/client.pyi index 02e8d7002..8b1007e40 100644 --- a/stdlib/3/http/client.pyi +++ b/stdlib/3/http/client.pyi @@ -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: ...