diff -r 7c48bb929e6e Doc/library/urllib.request.rst --- a/Doc/library/urllib.request.rst Tue Mar 27 11:49:21 2012 +0200 +++ b/Doc/library/urllib.request.rst Tue Mar 27 13:33:57 2012 -0400 @@ -16,7 +16,7 @@ The :mod:`urllib.request` module defines the following functions: -.. function:: urlopen(url, data=None[, timeout], *, cafile=None, capath=None) +.. function:: urlopen(url, data=None, timeout=None, *, cafile=None, capath=None) Open the URL *url*, which can be either a string or a :class:`Request` object. @@ -44,8 +44,8 @@ The optional *timeout* parameter specifies a timeout in seconds for blocking operations like the connection attempt (if not specified, - the global default timeout setting will be used). This actually - only works for HTTP, HTTPS and FTP connections. + the global default socket module timeout setting will be used). + This actually only works for HTTP, HTTPS and FTP connections. The optional *cafile* and *capath* parameters specify a set of trusted CA certificates for HTTPS requests. *cafile* should point to a single diff -r 7c48bb929e6e Lib/urllib/request.py --- a/Lib/urllib/request.py Tue Mar 27 11:49:21 2012 +0200 +++ b/Lib/urllib/request.py Tue Mar 27 13:33:57 2012 -0400 @@ -134,9 +134,10 @@ __version__ = sys.version[:3] _opener = None -def urlopen(url, data=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, - *, cafile=None, capath=None): +def urlopen(url, data=None, timeout=None, *, cafile=None, capath=None): global _opener + if timeout is None: + timeout = socket._GLOBAL_DEFAULT_TIMEOUT if cafile or capath: if not _have_ssl: raise ValueError('SSL support not available')