mirror of
https://github.com/python/cpython.git
synced 2025-10-25 10:44:55 +00:00
asyncio: Don't log ConnectionAbortedError
Issue #26509: In fatal error handlers, don't log ConnectionAbortedError which occur on Windows.
This commit is contained in:
parent
2ba8ece5be
commit
c94a93aecb
5 changed files with 10 additions and 5 deletions
|
|
@ -54,6 +54,12 @@
|
||||||
# before cleanup of cancelled handles is performed.
|
# before cleanup of cancelled handles is performed.
|
||||||
_MIN_CANCELLED_TIMER_HANDLES_FRACTION = 0.5
|
_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):
|
def _format_handle(handle):
|
||||||
cb = handle._callback
|
cb = handle._callback
|
||||||
if inspect.ismethod(cb) and isinstance(cb.__self__, tasks.Task):
|
if inspect.ismethod(cb) and isinstance(cb.__self__, tasks.Task):
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@ def __del__(self):
|
||||||
self.close()
|
self.close()
|
||||||
|
|
||||||
def _fatal_error(self, exc, message='Fatal error on pipe transport'):
|
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():
|
if self._loop.get_debug():
|
||||||
logger.debug("%r: %s", self, message, exc_info=True)
|
logger.debug("%r: %s", self, message, exc_info=True)
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -578,8 +578,7 @@ def __del__(self):
|
||||||
|
|
||||||
def _fatal_error(self, exc, message='Fatal error on transport'):
|
def _fatal_error(self, exc, message='Fatal error on transport'):
|
||||||
# Should be called from exception handler only.
|
# Should be called from exception handler only.
|
||||||
if isinstance(exc, (BrokenPipeError,
|
if isinstance(exc, base_events._FATAL_ERROR_IGNORE):
|
||||||
ConnectionResetError, ConnectionAbortedError)):
|
|
||||||
if self._loop.get_debug():
|
if self._loop.get_debug():
|
||||||
logger.debug("%r: %s", self, message, exc_info=True)
|
logger.debug("%r: %s", self, message, exc_info=True)
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -655,7 +655,7 @@ def _process_write_backlog(self):
|
||||||
|
|
||||||
def _fatal_error(self, exc, message='Fatal error on transport'):
|
def _fatal_error(self, exc, message='Fatal error on transport'):
|
||||||
# Should be called from exception handler only.
|
# 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():
|
if self._loop.get_debug():
|
||||||
logger.debug("%r: %s", self, message, exc_info=True)
|
logger.debug("%r: %s", self, message, exc_info=True)
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -575,7 +575,7 @@ def abort(self):
|
||||||
|
|
||||||
def _fatal_error(self, exc, message='Fatal error on pipe transport'):
|
def _fatal_error(self, exc, message='Fatal error on pipe transport'):
|
||||||
# should be called by exception handler only
|
# 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():
|
if self._loop.get_debug():
|
||||||
logger.debug("%r: %s", self, message, exc_info=True)
|
logger.debug("%r: %s", self, message, exc_info=True)
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue