Movatterモバイル変換


[0]ホーム

URL:


homepage

Issue29742

This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title:asyncio get_extra_info() throws exception
Type:Stage:resolved
Components:asyncioVersions:Python 3.7, Python 3.6, Python 3.5
process
Status:closedResolution:fixed
Dependencies:Superseder:
Assigned To:Nosy List: fafhrd91, r.david.murray, yselivanov
Priority:normalKeywords:

Created on2017-03-06 22:35 byfafhrd91, last changed2022-04-11 14:58 byadmin. This issue is nowclosed.

Pull Requests
URLStatusLinkedEdit
PR 494fafhrd91,2017-03-06 22:35
PR 525mergedfafhrd91,2017-03-06 23:36
PR 645mergedyselivanov,2017-03-12 19:29
PR 646mergedyselivanov,2017-03-12 19:30
PR 703larry,2017-03-17 21:00
Messages (8)
msg289138 -(view)Author: Nikolay Kim (fafhrd91)*Date: 2017-03-06 22:35
https://github.com/python/asyncio/issues/494
msg289139 -(view)Author: Nikolay Kim (fafhrd91)*Date: 2017-03-06 22:37
exception on get_extra_info() on closed ssl transport```Feb 18 13:18:09 btc electrumx_server.py[1732]: ERROR:ElectrumX:[15328] Traceback (most recent call last):Feb 18 13:18:09 btc electrumx_server.py[1732]:   File "/usr/local/lib/python3.5/dist-packages/electrumx-0.11.1-py3.5.egg/lib/jsonrpc.py", line 528, in process_single_requestFeb 18 13:18:09 btc electrumx_server.py[1732]:     result = await self.handle_payload(payload, self.request_handler)Feb 18 13:18:09 btc electrumx_server.py[1732]:   File "/usr/local/lib/python3.5/dist-packages/electrumx-0.11.1-py3.5.egg/lib/jsonrpc.py", line 608, in handle_payloadFeb 18 13:18:09 btc electrumx_server.py[1732]:     return await handler(**kw_args)Feb 18 13:18:09 btc electrumx_server.py[1732]:   File "/usr/local/lib/python3.5/dist-packages/electrumx-0.11.1-py3.5.egg/server/session.py", line 282, in bannerFeb 18 13:18:09 btc electrumx_server.py[1732]:     if self.is_tor():Feb 18 13:18:09 btc electrumx_server.py[1732]:   File "/usr/local/lib/python3.5/dist-packages/electrumx-0.11.1-py3.5.egg/server/session.py", line 259, in is_torFeb 18 13:18:09 btc electrumx_server.py[1732]:     peer_info = self.peer_info()Feb 18 13:18:09 btc electrumx_server.py[1732]:   File "/usr/local/lib/python3.5/dist-packages/electrumx-0.11.1-py3.5.egg/lib/jsonrpc.py", line 764, in peer_infoFeb 18 13:18:09 btc electrumx_server.py[1732]:     return self.transport.get_extra_info('peername')Feb 18 13:18:09 btc electrumx_server.py[1732]:   File "/usr/lib/python3.5/asyncio/sslproto.py", line 306, in get_extra_infoFeb 18 13:18:09 btc electrumx_server.py[1732]:     return self._ssl_protocol._get_extra_info(name, default)Feb 18 13:18:09 btc electrumx_server.py[1732]:   File "/usr/lib/python3.5/asyncio/sslproto.py", line 537, in _get_extra_infoFeb 18 13:18:09 btc electrumx_server.py[1732]:     return self._transport.get_extra_info(name, default)Feb 18 13:18:09 btc electrumx_server.py[1732]: AttributeError: 'NoneType' object has no attribute 'get_extra_info'```
msg289140 -(view)Author: R. David Murray (r.david.murray)*(Python committer)Date: 2017-03-06 22:44
Thanks for the report and PR, but your fix is not obviously correct.  In general exceptions are the way in Python that errors are reported, and asking for extra_info on a closed stream is an error.  The exception raised is not clear, so perhaps the asyncio folks will want to improve it.  Or perhaps I'm wrong and they will want to return None, but I'll be a bit surprised if that is the case :)
msg289141 -(view)Author: Nikolay Kim (fafhrd91)*Date: 2017-03-06 22:49
get_extra_info() returns optional transport information, I think it is ok to return None for closed transport.https://github.com/python/cpython/blob/master/Lib/asyncio/transports.py#L18I propose this feature initially, during early tulip developmentbut now I think it is not good api.
msg289142 -(view)Author: Yury Selivanov (yselivanov)*(Python committer)Date: 2017-03-06 22:50
> Thanks for the report and PR, but your fix is not obviously correct.  Not for this particular asyncio method though, see asyncio PEP [1]. But there's an actual bug in the PR, instead of returning `None` we should return `default`.[1]https://www.python.org/dev/peps/pep-3156/#methods-for-all-transports
msg290192 -(view)Author: Yury Selivanov (yselivanov)*(Python committer)Date: 2017-03-24 22:21
New changesetdb522dc86294a99f46a63cd5b54c7c4ab8017c96 by Yury Selivanov in branch '3.5':bpo-29742: asyncio get_extra_info() throws exception (#525) (#646)https://github.com/python/cpython/commit/db522dc86294a99f46a63cd5b54c7c4ab8017c96
msg290193 -(view)Author: Yury Selivanov (yselivanov)*(Python committer)Date: 2017-03-24 22:21
New changeset99f8d33a94c8951fd6b2d5f079d20be698150993 by Yury Selivanov in branch '3.6':bpo-29742: asyncio get_extra_info() throws exception (#525) (#645)https://github.com/python/cpython/commit/99f8d33a94c8951fd6b2d5f079d20be698150993
msg290196 -(view)Author: Yury Selivanov (yselivanov)*(Python committer)Date: 2017-03-24 22:21
New changeset2b27e2e6a35c3d3e369612b984017fe0d1bfcf0c by Yury Selivanov (Nikolay Kim) in branch 'master':bpo-29742: asyncio get_extra_info() throws exception (#525)https://github.com/python/cpython/commit/2b27e2e6a35c3d3e369612b984017fe0d1bfcf0c
History
DateUserActionArgs
2022-04-11 14:58:43adminsetgithub: 73928
2017-03-24 22:21:52yselivanovsetmessages: +msg290196
2017-03-24 22:21:26yselivanovsetmessages: +msg290193
2017-03-24 22:21:21yselivanovsetmessages: +msg290192
2017-03-17 21:00:33larrysetpull_requests: +pull_request596
2017-03-12 21:06:52yselivanovsetstatus: open -> closed
resolution: fixed
stage: resolved
2017-03-12 19:30:20yselivanovsetpull_requests: +pull_request535
2017-03-12 19:29:56yselivanovsetpull_requests: +pull_request534
2017-03-06 23:40:52gvanrossumsetnosy: -gvanrossum
2017-03-06 23:36:42fafhrd91setpull_requests: +pull_request438
2017-03-06 22:50:39yselivanovsetmessages: +msg289142
2017-03-06 22:49:12fafhrd91setmessages: +msg289141
2017-03-06 22:44:24r.david.murraysetnosy: +r.david.murray,gvanrossum,yselivanov
messages: +msg289140
components: + asyncio
2017-03-06 22:37:31fafhrd91setmessages: +msg289139
2017-03-06 22:35:43fafhrd91create
Supported byThe Python Software Foundation,
Powered byRoundup
Copyright © 1990-2022,Python Software Foundation
Legal Statements

[8]ページ先頭

©2009-2026 Movatter.jp