[docs] [issue8595] Explain the default timeout in http-client-related libraries
report at bugs.python.org
Thu Jul 1 16:13:57 CEST 2010
Eric Smith <eric at trueblade.com> added the comment:
I think you could preserve backward compatibility by doing something like the following (in httplib):
_sentinel = object()
__HTTP_DEFAULT_TIMEOUT = _sentinel
In httplib.HTTPConnection.__init__(), in Python 2.6.
def __init__(self, host, port=None, strict=None,
if timeout is None:
if _HTTP_DEFAULT_TIMEOUT is _sentinel:
timeout = socket._GLOBAL_DEFAULT_TIMEOUT
timeout = _HTTP_DEFAULT_TIMEOUT
That way, if _HTTP_DEFAULT_TIMEOUT is never set, it will use the the socket timeout. Admittedly I'd rather see all uses of module globals go away, but I think this would be a good compromise.
Python tracker <report at bugs.python.org>
More information about the docs