diff -r 6e26b5291c41 Lib/pydoc.py --- a/Lib/pydoc.py Wed Nov 19 00:11:05 2014 +0200 +++ b/Lib/pydoc.py Wed Nov 19 09:24:38 2014 +0200 @@ -2098,7 +2098,6 @@ pydoc by Ka-Ping Yee <ping@l def __init__(self, port, callback): host = 'localhost' self.address = (host, port) - self.url = 'http://%s:%d/' % (host, port) self.callback = callback self.base.__init__(self, self.address, self.handler) @@ -2111,6 +2110,7 @@ pydoc by Ka-Ping Yee <ping@l def server_activate(self): self.base.server_activate(self) + self.url = 'http://%s:%d/' % (self.address[0], self.server_port) if self.callback: self.callback(self) DocServer.base = BaseHTTPServer.HTTPServer @@ -2384,7 +2384,8 @@ def cli(): Search for a keyword in the synopsis lines of all available modules. %s -p - Start an HTTP server on the given port on the local machine. + Start an HTTP server on the given port on the local machine. Port + number 0 can be used to get an arbitrary unused port. %s -g Pop up a graphical interface for finding and serving documentation.