[Python-checkins] cpython (2.7): Issue #18905: "pydoc -p 0" now outputs actually used port. Based on patch by
serhiy.storchaka
python-checkins at python.org
Thu Nov 27 23:15:45 CET 2014
https://hg.python.org/cpython/rev/ac7f3161aa53
changeset: 93629:ac7f3161aa53
branch: 2.7
parent: 93624:7e534e18a99a
user: Serhiy Storchaka <storchaka at gmail.com>
date: Thu Nov 27 23:45:37 2014 +0200
summary:
Issue #18905: "pydoc -p 0" now outputs actually used port. Based on patch by
Wieland Hoffmann.
files:
Lib/pydoc.py | 8 +++++---
Misc/NEWS | 6 ++++++
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/Lib/pydoc.py b/Lib/pydoc.py
--- a/Lib/pydoc.py
+++ b/Lib/pydoc.py
@@ -17,7 +17,8 @@
of all available modules.
Run "pydoc -p <port>" to start an HTTP server on a given port on the
-local machine to generate documentation web pages.
+local machine to generate documentation web pages. Port number 0 can be
+used to get an arbitrary unused port.
For platforms without a command line, "pydoc -g" starts the HTTP server
and also pops up a little window for controlling it.
@@ -2098,7 +2099,6 @@
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 +2111,7 @@
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 +2385,8 @@
Search for a keyword in the synopsis lines of all available modules.
%s -p <port>
- 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.
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -22,6 +22,12 @@
- Issue #21514: The documentation of the json module now refers to new JSON RFC
7159 instead of obsoleted RFC 4627.
+Tools/Demos
+-----------
+
+- Issue #18905: "pydoc -p 0" now outputs actually used port. Based on patch by
+ Wieland Hoffmann.
+
What's New in Python 2.7.9 release candidate 1?
===============================================
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list