summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_logging.py
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2011-05-23 22:00:42 (GMT)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2011-05-23 22:00:42 (GMT)
commit3ef1229b14ef901d19a0a9cc4a4ec70100638b36 (patch)
tree412f671128126e0b974e19ce50788b483ca7f39d /Lib/test/test_logging.py
parent17ec7cd9ca28ae2e8320a740d00927dcaed67274 (diff)
downloadcpython-3ef1229b14ef901d19a0a9cc4a4ec70100638b36.zip
cpython-3ef1229b14ef901d19a0a9cc4a4ec70100638b36.tar.gz
cpython-3ef1229b14ef901d19a0a9cc4a4ec70100638b36.tar.bz2
Issue #12151: Test now ignores datagram socket errors after server is closed.
Diffstat (limited to 'Lib/test/test_logging.py')
-rw-r--r--Lib/test/test_logging.py21
1 files changed, 11 insertions, 10 deletions
diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py
index 8166b33..e4fc266 100644
--- a/Lib/test/test_logging.py
+++ b/Lib/test/test_logging.py
@@ -888,7 +888,8 @@ if threading:
before calling :meth:`start`, so that the server will
set up the socket and listen on it.
"""
- def __init__(self, addr, handler, poll_interval=0.5, bind_and_activate=True):
+ def __init__(self, addr, handler, poll_interval=0.5,
+ bind_and_activate=True):
class DelegatingUDPRequestHandler(DatagramRequestHandler):
def handle(self):
@@ -896,15 +897,15 @@ if threading:
def finish(self):
data = self.wfile.getvalue()
- try:
- super(DelegatingUDPRequestHandler, self).finish()
- except socket.error:
- msg = ('Error during finish, while sending %r, '
- 'closed = %s')
- print(msg % (data, self.server._closed), file=sys.stderr)
- raise
-
- ThreadingUDPServer.__init__(self, addr, DelegatingUDPRequestHandler,
+ if data:
+ try:
+ super(DelegatingUDPRequestHandler, self).finish()
+ except socket.error:
+ if not self.server._closed:
+ raise
+
+ ThreadingUDPServer.__init__(self, addr,
+ DelegatingUDPRequestHandler,
bind_and_activate)
ControlMixin.__init__(self, handler, poll_interval)
self._closed = False