]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #14574: Ignore socket errors raised when flushing a connection on close.
authorKristján Valur Jónsson <kristjan@ccpgames.com>
Tue, 25 Dec 2012 22:46:32 +0000 (22:46 +0000)
committerKristján Valur Jónsson <kristjan@ccpgames.com>
Tue, 25 Dec 2012 22:46:32 +0000 (22:46 +0000)
Doc/library/socketserver.rst
Lib/SocketServer.py

index c34b486806670ea243311d78ebef47b3651a1498..d225392ba3568a6c803a8fcd490f4724d21b5796 100644 (file)
@@ -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()
index 1594321909c149586da5ceeb4f41cfafdd2f6e3e..26611b74d1f912720113040fbcce26207e6e785a 100644 (file)
@@ -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()