[Python-checkins] r80712 - in python/trunk: Lib/logging/config.py Lib/test/test_logging.py Misc/NEWS
vinay.sajip
python-checkins at python.org
Mon May 3 17:11:53 CEST 2010
Author: vinay.sajip
Date: Mon May 3 17:11:53 2010
New Revision: 80712
Log:
Issue #8576: logging updated to remove usage of find_unused_port().
Modified:
python/trunk/Lib/logging/config.py
python/trunk/Lib/test/test_logging.py
python/trunk/Misc/NEWS
Modified: python/trunk/Lib/logging/config.py
==============================================================================
--- python/trunk/Lib/logging/config.py (original)
+++ python/trunk/Lib/logging/config.py Mon May 3 17:11:53 2010
@@ -873,6 +873,8 @@
def run(self):
server = self.rcvr(port=self.port, handler=self.hdlr,
ready=self.ready)
+ if self.port == 0:
+ self.port = server.server_address[1]
self.ready.set()
global _listener
logging._acquireLock()
Modified: python/trunk/Lib/test/test_logging.py
==============================================================================
--- python/trunk/Lib/test/test_logging.py (original)
+++ python/trunk/Lib/test/test_logging.py Mon May 3 17:11:53 2010
@@ -38,8 +38,7 @@
import struct
import sys
import tempfile
-from test.test_support import captured_stdout, run_with_locale, run_unittest,\
- find_unused_port
+from test.test_support import captured_stdout, run_with_locale, run_unittest
import textwrap
import unittest
import warnings
@@ -1664,10 +1663,12 @@
@unittest.skipUnless(threading, 'listen() needs threading to work')
def setup_via_listener(self, text):
- port = find_unused_port()
- t = logging.config.listen(port)
+ # Ask for a randomly assigned port (by using port 0)
+ t = logging.config.listen(0)
t.start()
t.ready.wait()
+ # Now get the port allocated
+ port = t.port
t.ready.clear()
try:
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS (original)
+++ python/trunk/Misc/NEWS Mon May 3 17:11:53 2010
@@ -31,6 +31,8 @@
Library
-------
+- Issue #8576: logging updated to remove usage of find_unused_port().
+
- Issue #4687: Fix accuracy of garbage collection runtimes displayed with
gc.DEBUG_STATS.
More information about the Python-checkins
mailing list