Merge 3.5 (asyncio)

This commit is contained in:
Victor Stinner 2016-04-01 21:43:54 +02:00
commit 00f4648a39
5 changed files with 10 additions and 5 deletions

View File

@ -54,6 +54,12 @@ _MIN_SCHEDULED_TIMER_HANDLES = 100
# 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):

View File

@ -91,7 +91,7 @@ class _ProactorBasePipeTransport(transports._FlowControlMixin,
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:

View File

@ -579,8 +579,7 @@ class _SelectorTransport(transports._FlowControlMixin,
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:

View File

@ -656,7 +656,7 @@ class SSLProtocol(protocols.Protocol):
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:

View File

@ -577,7 +577,7 @@ class _UnixWritePipeTransport(transports._FlowControlMixin,
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: