summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristján Valur Jónsson <kristjan@ccpgames.com>2012-12-25 22:46:32 (GMT)
committerKristján Valur Jónsson <kristjan@ccpgames.com>2012-12-25 22:46:32 (GMT)
commit36852b7844fd15fb80a9366ea861c2d5159bb51e (patch)
treeeb6889003a2df91bdb2d2320cf5f1caaaa32cc5d
parent303eb478f27720f0e5b6b4147b05f9c15f7fd8f6 (diff)
downloadcpython-36852b7844fd15fb80a9366ea861c2d5159bb51e.zip
cpython-36852b7844fd15fb80a9366ea861c2d5159bb51e.tar.gz
cpython-36852b7844fd15fb80a9366ea861c2d5159bb51e.tar.bz2
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 5287f17..4f22347 100644
--- a/Doc/library/socketserver.rst
+++ b/Doc/library/socketserver.rst
@@ -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()
diff --git a/Lib/socketserver.py b/Lib/socketserver.py
index adf9f38..8f80a7d 100644
--- a/Lib/socketserver.py
+++ b/Lib/socketserver.py
@@ -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()