From 1f0dc6ee053f2b279afdef89464b0bda7f5c9e5a Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Sun, 24 Nov 2019 03:51:33 -0800 Subject: [PATCH] timeout argument to urllib.request.urlopen is Optional (#3487) The docs (https://docs.python.org/3/library/urllib.request.html#urllib.request.urlopen) aren't very precise about this, but passing `None` seems to work in practice. --- stdlib/3/urllib/request.pyi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stdlib/3/urllib/request.pyi b/stdlib/3/urllib/request.pyi index a18210a59..7dd954d4b 100644 --- a/stdlib/3/urllib/request.pyi +++ b/stdlib/3/urllib/request.pyi @@ -21,7 +21,7 @@ class _HTTPResponse(HTTPResponse): def urlopen( url: Union[str, Request], data: Optional[bytes] = ..., - timeout: float = ..., *, cafile: Optional[str] = ..., + timeout: Optional[float] = ..., *, cafile: Optional[str] = ..., capath: Optional[str] = ..., cadefault: bool = ..., context: Optional[ssl.SSLContext] = ... ) -> _UrlopenRet: ... @@ -71,7 +71,7 @@ class OpenerDirector: addheaders: List[Tuple[str, str]] def add_handler(self, handler: BaseHandler) -> None: ... def open(self, url: Union[str, Request], data: Optional[bytes] = ..., - timeout: float = ...) -> _UrlopenRet: ... + timeout: Optional[float] = ...) -> _UrlopenRet: ... def error(self, proto: str, *args: Any) -> _UrlopenRet: ...