[Python-checkins] cpython (merge 3.5 -> default): Merge 3.5 (asyncio)

victor.stinner python-checkins at python.org
Fri Apr 1 15:45:08 EDT 2016


https://hg.python.org/cpython/rev/a442bf076a32
changeset: 100825:a442bf076a32
parent: 100823:e3ecbac90eaf
parent: 100824:68e694475483
user: Victor Stinner <victor.stinner at gmail.com>
date: Fri Apr 01 21:43:54 2016 +0200
summary:
 Merge 3.5 (asyncio)
files:
 Lib/asyncio/base_events.py | 6 ++++++
 Lib/asyncio/proactor_events.py | 2 +-
 Lib/asyncio/selector_events.py | 3 +--
 Lib/asyncio/sslproto.py | 2 +-
 Lib/asyncio/unix_events.py | 2 +-
 5 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/Lib/asyncio/base_events.py b/Lib/asyncio/base_events.py
--- a/Lib/asyncio/base_events.py
+++ b/Lib/asyncio/base_events.py
@@ -54,6 +54,12 @@
 # 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):
diff --git a/Lib/asyncio/proactor_events.py b/Lib/asyncio/proactor_events.py
--- a/Lib/asyncio/proactor_events.py
+++ b/Lib/asyncio/proactor_events.py
@@ -91,7 +91,7 @@
 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:
diff --git a/Lib/asyncio/selector_events.py b/Lib/asyncio/selector_events.py
--- a/Lib/asyncio/selector_events.py
+++ b/Lib/asyncio/selector_events.py
@@ -579,8 +579,7 @@
 
 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:
diff --git a/Lib/asyncio/sslproto.py b/Lib/asyncio/sslproto.py
--- a/Lib/asyncio/sslproto.py
+++ b/Lib/asyncio/sslproto.py
@@ -656,7 +656,7 @@
 
 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:
diff --git a/Lib/asyncio/unix_events.py b/Lib/asyncio/unix_events.py
--- a/Lib/asyncio/unix_events.py
+++ b/Lib/asyncio/unix_events.py
@@ -577,7 +577,7 @@
 
 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:
-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /