From: Kristján Valur Jónsson Date: Tue, 25 Dec 2012 22:46:32 +0000 (+0000) Subject: Issue #14574: Ignore socket errors raised when flushing a connection on close. X-Git-Tag: v2.7.5~109^2~19 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b0d1c37d737742eb098b985475987f460a13a6c2;p=thirdparty%2FPython%2Fcpython.git Issue #14574: Ignore socket errors raised when flushing a connection on close. --- diff --git a/Doc/library/socketserver.rst b/Doc/library/socketserver.rst index c34b48680667..d225392ba356 100644 --- a/Doc/library/socketserver.rst +++ b/Doc/library/socketserver.rst @@ -306,8 +306,8 @@ request. .. method:: RequestHandler.finish() Called after the :meth:`handle` method to perform any clean-up actions - required. The default implementation does nothing. If :meth:`setup` or - :meth:`handle` raise an exception, this function will not be called. + required. The default implementation does nothing. If :meth:`setup` + raises an exception, this function will not be called. .. method:: RequestHandler.handle() diff --git a/Lib/SocketServer.py b/Lib/SocketServer.py index 1594321909c1..26611b74d1f9 100644 --- a/Lib/SocketServer.py +++ b/Lib/SocketServer.py @@ -701,7 +701,12 @@ class StreamRequestHandler(BaseRequestHandler): def finish(self): if not self.wfile.closed: - self.wfile.flush() + try: + self.wfile.flush() + except socket.error: + # An final socket error may have occurred here, such as + # the local error ECONNABORTED. + pass self.wfile.close() self.rfile.close()