mirror of
https://github.com/python/cpython
synced 2024-09-16 00:07:33 +00:00
bpo-29742: asyncio get_extra_info() throws exception (#525)
This commit is contained in:
parent
783d0c1a1c
commit
2b27e2e6a3
|
@ -543,8 +543,10 @@ def eof_received(self):
|
|||
def _get_extra_info(self, name, default=None):
|
||||
if name in self._extra:
|
||||
return self._extra[name]
|
||||
else:
|
||||
elif self._transport is not None:
|
||||
return self._transport.get_extra_info(name, default)
|
||||
else:
|
||||
return default
|
||||
|
||||
def _start_shutdown(self):
|
||||
if self._in_shutdown:
|
||||
|
|
|
@ -95,5 +95,17 @@ def test_connection_lost(self):
|
|||
test_utils.run_briefly(self.loop)
|
||||
self.assertIsInstance(waiter.exception(), ConnectionAbortedError)
|
||||
|
||||
def test_get_extra_info_on_closed_connection(self):
|
||||
waiter = asyncio.Future(loop=self.loop)
|
||||
ssl_proto = self.ssl_protocol(waiter)
|
||||
self.assertIsNone(ssl_proto._get_extra_info('socket'))
|
||||
default = object()
|
||||
self.assertIs(ssl_proto._get_extra_info('socket', default), default)
|
||||
self.connection_made(ssl_proto)
|
||||
self.assertIsNotNone(ssl_proto._get_extra_info('socket'))
|
||||
ssl_proto.connection_lost(None)
|
||||
self.assertIsNone(ssl_proto._get_extra_info('socket'))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
|
@ -335,6 +335,9 @@ Library
|
|||
- bpo-28518: Start a transaction implicitly before a DML statement.
|
||||
Patch by Aviv Palivoda.
|
||||
|
||||
- bpo-29742: get_extra_info() raises exception if get called on closed ssl transport.
|
||||
Patch by Nikolay Kim.
|
||||
|
||||
- Issue #16285: urrlib.parse.quote is now based on RFC 3986 and hence includes
|
||||
'~' in the set of characters that is not quoted by default. Patch by
|
||||
Christian Theune and Ratnadeep Debnath.
|
||||
|
|
Loading…
Reference in a new issue