Skip to content

Commit ff018e4

Browse files
committed
asyncio: sync with Tulip
* Remove unused SSLProtocol._closing attribute * test_sslproto: skip test if ssl module is missing * Python issue python#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.
1 parent b68c420 commit ff018e4

3 files changed

Lines changed: 7 additions & 2 deletions

File tree

‎Lib/asyncio/base_events.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -956,7 +956,8 @@ def default_exception_handler(self, context):
956956
else:
957957
exc_info = False
958958

959-
if (self._current_handle is not None
959+
if ('source_traceback' not in context
960+
and self._current_handle is not None
960961
and self._current_handle._source_traceback):
961962
context['handle_traceback'] = self._current_handle._source_traceback
962963

‎Lib/asyncio/sslproto.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,6 @@ def __init__(self, loop, app_protocol, sslcontext, waiter,
408408
self._write_buffer_size = 0
409409

410410
self._waiter = waiter
411-
self._closing = False
412411
self._loop = loop
413412
self._app_protocol = app_protocol
414413
self._app_transport = _SSLProtocolTransport(self._loop,

‎Lib/test/test_asyncio/test_sslproto.py‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
import unittest
44
from unittest import mock
5+
try:
6+
import ssl
7+
except ImportError:
8+
ssl = None
59

610
import asyncio
711
from asyncio import sslproto
@@ -14,6 +18,7 @@ def setUp(self):
1418
self.loop = asyncio.new_event_loop()
1519
self.set_event_loop(self.loop)
1620

21+
@unittest.skipIf(ssl is None, 'No ssl module')
1722
def test_cancel_handshake(self):
1823
# Python issue #23197: cancelling an handshake must not raise an
1924
# exception or log an error, even if the handshake failed

0 commit comments

Comments
 (0)