]> granicus.if.org Git - python/commitdiff
asyncio: sync with Tulip
authorVictor Stinner <victor.stinner@gmail.com>
Tue, 27 Jan 2015 23:30:40 +0000 (00:30 +0100)
committerVictor Stinner <victor.stinner@gmail.com>
Tue, 27 Jan 2015 23:30:40 +0000 (00:30 +0100)
* Remove unused SSLProtocol._closing attribute
* test_sslproto: skip test if ssl module is missing
* Python issue #23208: Don't use the traceback of the current handle if we
  already know the traceback of the source. The handle may be more revelant,
  but having 3 tracebacks (handle, source, exception) becomes more difficult to
  read. The handle may be preferred later but it requires more work to make
  this choice.

Lib/asyncio/base_events.py
Lib/asyncio/sslproto.py
Lib/test/test_asyncio/test_sslproto.py

index 1c51a7cf8531f347cc66dca3afef45fac836f30e..e40d3ad5f2b4cd23fa71f4f9dbbc205456fbbb5d 100644 (file)
@@ -956,7 +956,8 @@ class BaseEventLoop(events.AbstractEventLoop):
         else:
             exc_info = False
 
-        if (self._current_handle is not None
+        if ('source_traceback' not in context
+        and self._current_handle is not None
         and self._current_handle._source_traceback):
             context['handle_traceback'] = self._current_handle._source_traceback
 
index 117dc565b6c316ccc2b4449667805f56174e6426..f2b856c40cb9f6afedd3ef3888a78c3b03edea1b 100644 (file)
@@ -408,7 +408,6 @@ class SSLProtocol(protocols.Protocol):
         self._write_buffer_size = 0
 
         self._waiter = waiter
-        self._closing = False
         self._loop = loop
         self._app_protocol = app_protocol
         self._app_transport = _SSLProtocolTransport(self._loop,
index 812dedbe1d796be5a116d9ccbde0c640b4c3190a..b1a61c483d2ae250915b6162c20e8db2eedaadaa 100644 (file)
@@ -2,6 +2,10 @@
 
 import unittest
 from unittest import mock
+try:
+    import ssl
+except ImportError:
+    ssl = None
 
 import asyncio
 from asyncio import sslproto
@@ -14,6 +18,7 @@ class SslProtoHandshakeTests(test_utils.TestCase):
         self.loop = asyncio.new_event_loop()
         self.set_event_loop(self.loop)
 
+    @unittest.skipIf(ssl is None, 'No ssl module')
     def test_cancel_handshake(self):
         # Python issue #23197: cancelling an handshake must not raise an
         # exception or log an error, even if the handshake failed