]> granicus.if.org Git - python/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 5287f17a28d9f99cb3e6cc9fa8207c4c3a01b8f8..4f223478e63dfed5d65158721e5ad6e3e6861bae 100644 (file)
@@ -299,8 +299,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 adf9f38ead8f23d54bce7cbb3da14090f3594cc0..8f80a7dc314f4ac4a49bcecbe2fdedccb9292161 100644 (file)
@@ -700,7 +700,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()