mirror of https://github.com/python/cpython.git
Issue #8576: logging updated to remove usage of find_unused_port().
This commit is contained in:
parent
c1f5c2f333
commit
27a1370ae0
|
@ -873,6 +873,8 @@ def __init__(self, rcvr, hdlr, port):
|
||||||
def run(self):
|
def run(self):
|
||||||
server = self.rcvr(port=self.port, handler=self.hdlr,
|
server = self.rcvr(port=self.port, handler=self.hdlr,
|
||||||
ready=self.ready)
|
ready=self.ready)
|
||||||
|
if self.port == 0:
|
||||||
|
self.port = server.server_address[1]
|
||||||
self.ready.set()
|
self.ready.set()
|
||||||
global _listener
|
global _listener
|
||||||
logging._acquireLock()
|
logging._acquireLock()
|
||||||
|
|
|
@ -38,8 +38,7 @@
|
||||||
import struct
|
import struct
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
from test.test_support import captured_stdout, run_with_locale, run_unittest,\
|
from test.test_support import captured_stdout, run_with_locale, run_unittest
|
||||||
find_unused_port
|
|
||||||
import textwrap
|
import textwrap
|
||||||
import unittest
|
import unittest
|
||||||
import warnings
|
import warnings
|
||||||
|
@ -1664,10 +1663,12 @@ def test_config13_failure(self):
|
||||||
|
|
||||||
@unittest.skipUnless(threading, 'listen() needs threading to work')
|
@unittest.skipUnless(threading, 'listen() needs threading to work')
|
||||||
def setup_via_listener(self, text):
|
def setup_via_listener(self, text):
|
||||||
port = find_unused_port()
|
# Ask for a randomly assigned port (by using port 0)
|
||||||
t = logging.config.listen(port)
|
t = logging.config.listen(0)
|
||||||
t.start()
|
t.start()
|
||||||
t.ready.wait()
|
t.ready.wait()
|
||||||
|
# Now get the port allocated
|
||||||
|
port = t.port
|
||||||
t.ready.clear()
|
t.ready.clear()
|
||||||
try:
|
try:
|
||||||
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
|
|
|
@ -31,6 +31,8 @@ Core and Builtins
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- Issue #8576: logging updated to remove usage of find_unused_port().
|
||||||
|
|
||||||
- Issue #4687: Fix accuracy of garbage collection runtimes displayed with
|
- Issue #4687: Fix accuracy of garbage collection runtimes displayed with
|
||||||
gc.DEBUG_STATS.
|
gc.DEBUG_STATS.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue