mirror of
https://github.com/python/cpython.git
synced 2025-10-05 06:31:48 +00:00
parent
216803d8e1
commit
db522dc862
3 changed files with 18 additions and 1 deletions
|
@ -542,8 +542,10 @@ class SSLProtocol(protocols.Protocol):
|
||||||
def _get_extra_info(self, name, default=None):
|
def _get_extra_info(self, name, default=None):
|
||||||
if name in self._extra:
|
if name in self._extra:
|
||||||
return self._extra[name]
|
return self._extra[name]
|
||||||
else:
|
elif self._transport is not None:
|
||||||
return self._transport.get_extra_info(name, default)
|
return self._transport.get_extra_info(name, default)
|
||||||
|
else:
|
||||||
|
return default
|
||||||
|
|
||||||
def _start_shutdown(self):
|
def _start_shutdown(self):
|
||||||
if self._in_shutdown:
|
if self._in_shutdown:
|
||||||
|
|
|
@ -95,5 +95,17 @@ class SslProtoHandshakeTests(test_utils.TestCase):
|
||||||
test_utils.run_briefly(self.loop)
|
test_utils.run_briefly(self.loop)
|
||||||
self.assertIsInstance(waiter.exception(), ConnectionAbortedError)
|
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__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
|
@ -43,6 +43,9 @@ Extension Modules
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- bpo-29742: get_extra_info() raises exception if get called on closed ssl transport.
|
||||||
|
Patch by Nikolay Kim.
|
||||||
|
|
||||||
- bpo-8256: Fixed possible failing or crashing input() if attributes "encoding"
|
- bpo-8256: Fixed possible failing or crashing input() if attributes "encoding"
|
||||||
or "errors" of sys.stdin or sys.stdout are not set or are not strings.
|
or "errors" of sys.stdin or sys.stdout are not set or are not strings.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue