]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
asyncio: Don't log ConnectionAbortedError
authorVictor Stinner <victor.stinner@gmail.com>
Fri, 1 Apr 2016 19:43:39 +0000 (21:43 +0200)
committerVictor Stinner <victor.stinner@gmail.com>
Fri, 1 Apr 2016 19:43:39 +0000 (21:43 +0200)
Issue #26509: In fatal error handlers, don't log ConnectionAbortedError which
occur on Windows.

Lib/asyncio/base_events.py
Lib/asyncio/proactor_events.py
Lib/asyncio/selector_events.py
Lib/asyncio/sslproto.py
Lib/asyncio/unix_events.py

index 9d07673fbad2120f7d65e0963b601f7eb0f0ea06..3703480eba0e98d831c8827ecc62f2c9f8d8fc69 100644 (file)
@@ -54,6 +54,12 @@ _MIN_SCHEDULED_TIMER_HANDLES = 100
 # before cleanup of cancelled handles is performed.
 _MIN_CANCELLED_TIMER_HANDLES_FRACTION = 0.5
 
+# Exceptions which must not call the exception handler in fatal error
+# methods (_fatal_error())
+_FATAL_ERROR_IGNORE = (BrokenPipeError,
+                       ConnectionResetError, ConnectionAbortedError)
+
+
 def _format_handle(handle):
     cb = handle._callback
     if inspect.ismethod(cb) and isinstance(cb.__self__, tasks.Task):
index 14c0659ddee466a0b1bcee4e09335eb39d61e20e..b2ddee40718ec1684634057280dee423323fee0c 100644 (file)
@@ -90,7 +90,7 @@ class _ProactorBasePipeTransport(transports._FlowControlMixin,
                 self.close()
 
     def _fatal_error(self, exc, message='Fatal error on pipe transport'):
-        if isinstance(exc, (BrokenPipeError, ConnectionResetError)):
+        if isinstance(exc, base_events._FATAL_ERROR_IGNORE):
             if self._loop.get_debug():
                 logger.debug("%r: %s", self, message, exc_info=True)
         else:
index 812fac19f86095d63e68d0e4ee7d0e7c4eff8815..7b1eef20f225af6f1b708945c584b34a6fdcf2db 100644 (file)
@@ -578,8 +578,7 @@ class _SelectorTransport(transports._FlowControlMixin,
 
     def _fatal_error(self, exc, message='Fatal error on transport'):
         # Should be called from exception handler only.
-        if isinstance(exc, (BrokenPipeError,
-                            ConnectionResetError, ConnectionAbortedError)):
+        if isinstance(exc, base_events._FATAL_ERROR_IGNORE):
             if self._loop.get_debug():
                 logger.debug("%r: %s", self, message, exc_info=True)
         else:
index dde980b68f835e73e53e2c10cbe8f126946aea53..33b1840dfaf65e4c7b73dd288ea36085155f187d 100644 (file)
@@ -655,7 +655,7 @@ class SSLProtocol(protocols.Protocol):
 
     def _fatal_error(self, exc, message='Fatal error on transport'):
         # Should be called from exception handler only.
-        if isinstance(exc, (BrokenPipeError, ConnectionResetError)):
+        if isinstance(exc, base_events._FATAL_ERROR_IGNORE):
             if self._loop.get_debug():
                 logger.debug("%r: %s", self, message, exc_info=True)
         else:
index 7747ff41bb8812ffc038c442384155bfcf779b37..46686a0d1342ea43a96d9d78ab13a71d2bee5800 100644 (file)
@@ -575,7 +575,7 @@ class _UnixWritePipeTransport(transports._FlowControlMixin,
 
     def _fatal_error(self, exc, message='Fatal error on pipe transport'):
         # should be called by exception handler only
-        if isinstance(exc, (BrokenPipeError, ConnectionResetError)):
+        if isinstance(exc, base_events._FATAL_ERROR_IGNORE):
             if self._loop.get_debug():
                 logger.debug("%r: %s", self, message, exc_info=True)
         else: