summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristján Valur Jónsson <kristjan@ccpgames.com>2012-12-26 15:13:29 +0000
committerKristján Valur Jónsson <kristjan@ccpgames.com>2012-12-26 15:13:29 +0000
commitc8e7e2bb76b7ebd0206e915b1d20b1cf4e6a75e1 (patch)
tree5946d31e9a93b27c2a729ed560e89837edae3399
parent00679a7ee0f6fa630c2f709f1d0a761e80181eb7 (diff)
parent36852b7844fd15fb80a9366ea861c2d5159bb51e (diff)
downloadcpython-git-c8e7e2bb76b7ebd0206e915b1d20b1cf4e6a75e1.tar.gz
Merge with 3.2 :
Issue #14574: Ignore socket errors raised when flushing a connection on close.
-rw-r--r--Doc/library/socketserver.rst4
-rw-r--r--Lib/socketserver.py7
2 files changed, 8 insertions, 3 deletions
diff --git a/Doc/library/socketserver.rst b/Doc/library/socketserver.rst
index 28e8a0aff7..e7f668cf07 100644
--- a/Doc/library/socketserver.rst
+++ b/Doc/library/socketserver.rst
@@ -313,8 +313,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 a21318d923..8332fdf66d 100644
--- a/Lib/socketserver.py
+++ b/Lib/socketserver.py
@@ -718,7 +718,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()