diff -r 869d50357a71 Lib/pydoc.py --- a/Lib/pydoc.py Sat Aug 31 21:14:00 2013 -0400 +++ b/Lib/pydoc.py Mon Sep 02 18:47:44 2013 +0200 @@ -2059,10 +2059,13 @@ 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) + @property + def url(self): + return "http://%s:%d" % self.server_address + def serve_until_quit(self): import select self.quit = False @@ -2345,7 +2348,8 @@ 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.