8000 bpo-29742: asyncio get_extra_info() throws exception by fafhrd91 · Pull Request #525 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-29742: asyncio get_extra_info() throws exception #525

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
< 8000 div id="diff-0ae38bdc337cc724282d20111dc780b8a9c07385c80476cf304d5b3c9ec306ec" data-details-container-group="file" class="file js-file js-details-container js-targetable-element show-inline-notes Details Details--on open " data-file-type=".py" data-file-deleted="false" data-tagsearch-path="Lib/asyncio/sslproto.py" data-targets="diff-file-filter.diffEntries" >
4 changes: 3 additions & 1 deletion Lib/asyncio/sslproto.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
12 changes: 12 additions & 0 deletions Lib/test/test_asyncio/test_sslproto.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
3 changes: 3 additions & 0 deletions Misc/NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,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.
Expand Down
0