cpython (merge 3.5 -> default): Merge 3.5 (asyncio)

https://hg.python.org/cpython/rev/a9b4da316283 changeset: 102221:a9b4da316283 parent: 102219:e5063a82f490 parent: 102220:100cf3f268ca user: Yury Selivanov <yury@magic.io> date: Tue Jun 28 10:55:49 2016 -0400 summary: Merge 3.5 (asyncio) files: Lib/asyncio/sslproto.py | 1 + Lib/test/test_asyncio/test_sslproto.py | 16 ++++++++++++++ 2 files changed, 17 insertions(+), 0 deletions(-) diff --git a/Lib/asyncio/sslproto.py b/Lib/asyncio/sslproto.py --- a/Lib/asyncio/sslproto.py +++ b/Lib/asyncio/sslproto.py @@ -5,6 +5,7 @@ except ImportError: # pragma: no cover ssl = None +from . import base_events from . import compat from . import protocols from . import transports diff --git a/Lib/test/test_asyncio/test_sslproto.py b/Lib/test/test_asyncio/test_sslproto.py --- a/Lib/test/test_asyncio/test_sslproto.py +++ b/Lib/test/test_asyncio/test_sslproto.py @@ -1,5 +1,6 @@ """Tests for asyncio/sslproto.py.""" +import logging import unittest from unittest import mock try: @@ -8,6 +9,7 @@ ssl = None import asyncio +from asyncio import log from asyncio import sslproto from asyncio import test_utils @@ -66,6 +68,20 @@ test_utils.run_briefly(self.loop) self.assertIsInstance(waiter.exception(), ConnectionResetError) + def test_fatal_error_no_name_error(self): + # From issue #363. + # _fatal_error() generates a NameError if sslproto.py + # does not import base_events. + waiter = asyncio.Future(loop=self.loop) + ssl_proto = self.ssl_protocol(waiter) + # Temporarily turn off error logging so as not to spoil test output. + log_level = log.logger.getEffectiveLevel() + log.logger.setLevel(logging.FATAL) + try: + ssl_proto._fatal_error(None) + finally: + # Restore error logging. + log.logger.setLevel(log_level) if __name__ == '__main__': unittest.main() -- Repository URL: https://hg.python.org/cpython
participants (1)
-
yury.selivanov