Movatterモバイル変換


[0]ホーム

URL:


homepage

Issue29271

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:Task.current_task(None) returns unexpected result
Type:behaviorStage:resolved
Components:asyncioVersions:Python 3.7, Python 3.6
process
Status:closedResolution:fixed
Dependencies:Superseder:
Assigned To: yselivanovNosy List: azazel, lelit, methane, yselivanov
Priority:normalKeywords:patch

Created on2017-01-13 22:11 byyselivanov, last changed2022-04-11 14:58 byadmin. This issue is nowclosed.

Files
File nameUploadedDescriptionEdit
task.patchyselivanov,2017-01-13 22:17review
Pull Requests
URLStatusLinkedEdit
PR 406mergedyselivanov,2017-03-02 22:35
PR 413mergedyselivanov,2017-03-03 03:25
PR 703larry,2017-03-17 21:00
PR 552closeddstufft,2017-03-31 16:36
Messages (6)
msg285445 -(view)Author: Yury Selivanov (yselivanov)*(Python committer)Date: 2017-01-13 22:11
Quoting Alberto Berdi from python-tulip mailing list:working with the Python 3.6 asyncio implemented in C, i've got what isfor me a strange behavior of the asyncio.Task.current taskfunction. Executing the following test: import asyncio async def coro():     print(asyncio.Task.current_task())     print(asyncio.Task.current_task(None))     print(asyncio.Task.current_task(loop=asyncio.get_event_loop())) loop = asyncio.get_event_loop() loop.run_until_complete(coro())in Py3.5, I obtain the result:<Task pending coro=<coro() running at test_task.py:4> cb=[_run_until_complete_cb() at /usr/lib/python3.5/asyncio/base_events.py:176]><Task pending coro=<coro() running at test_task.py:5> cb=[_run_until_complete_cb() at /usr/lib/python3.5/asyncio/base_events.py:176]><Task pending coro=<coro() running at test_task.py:6> cb=[_run_until_complete_cb() at /usr/lib/python3.5/asyncio/base_events.py:176]>In Py3.6, i get:<Task pending coro=<coro() running at test_task.py:4> cb=[_run_until_complete_cb() at /usr/lib/python3.6/asyncio/base_events.py:176]>None<Task pending coro=<coro() running at test_task.py:6> cb=[_run_until_complete_cb() at /usr/lib/python3.6/asyncio/base_events.py:176]>What's going on here? It's still right to expect the same result from the three calls or something has changed?The documentation for the Task.current_task() function seems unchanged between the two version.My python3.6 has version:$ python3.6 -VVPython 3.6.0 (default, Dec 29 2016, 04:29:02) [GCC 6.2.1 20161215]
msg285447 -(view)Author: Lele Gaifax (lelit)*Date: 2017-01-13 22:57
FWIW, the problem afflicts other functions, for example the following script exhibits a similar difference:import asyncioasync def coro():    print(asyncio.Task.all_tasks())    print(asyncio.Task.all_tasks(None))loop = asyncio.get_event_loop()loop.run_until_complete(coro())
msg285448 -(view)Author: Lele Gaifax (lelit)*Date: 2017-01-13 23:01
Yay, Yury is too fast!! :-)
msg285456 -(view)Author: Inada Naoki (methane)*(Python committer)Date: 2017-01-14 02:39
LGTM
msg288855 -(view)Author: Yury Selivanov (yselivanov)*(Python committer)Date: 2017-03-03 04:20
New changeset13802a3b11eb5202b16e464cbfb85c144f8581ce by Yury Selivanov in branch '3.6':bpo-29271: Fix Task.current_task and Task.all_tasks to accept None. (#406)https://github.com/python/cpython/commit/13802a3b11eb5202b16e464cbfb85c144f8581ce
msg290338 -(view)Author: Yury Selivanov (yselivanov)*(Python committer)Date: 2017-03-24 23:08
New changeset8d26aa930c0123933a1ceb12fceba4f5aef4e95e by Yury Selivanov in branch 'master':bpo-29271: Fix Task.current_task and Task.all_tasks to accept None. (#406)https://github.com/python/cpython/commit/8d26aa930c0123933a1ceb12fceba4f5aef4e95e
History
DateUserActionArgs
2022-04-11 14:58:42adminsetgithub: 73457
2017-03-31 16:36:33dstufftsetpull_requests: +pull_request1062
2017-03-24 23:08:55yselivanovsetmessages: +msg290338
2017-03-17 21:00:33larrysetpull_requests: +pull_request591
2017-03-03 23:10:28yselivanovsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2017-03-03 04:20:31yselivanovsetmessages: +msg288855
2017-03-03 03:25:10yselivanovsetpull_requests: +pull_request344
2017-03-02 22:35:14yselivanovsetpull_requests: +pull_request338
2017-01-14 02:39:31methanesetmessages: +msg285456
2017-01-13 23:01:26lelitsetmessages: +msg285448
2017-01-13 22:57:20lelitsetmessages: +msg285447
2017-01-13 22:31:21gvanrossumsetnosy: -gvanrossum
2017-01-13 22:28:00lelitsetnosy: +lelit
2017-01-13 22:26:22azazelsetnosy: +azazel
2017-01-13 22:17:41yselivanovsetfiles: +task.patch
nosy: +methane
keywords: +patch
2017-01-13 22:11:24yselivanovcreate
Supported byThe Python Software Foundation,
Powered byRoundup
Copyright © 1990-2022,Python Software Foundation
Legal Statements

[8]ページ先頭

©2009-2026 Movatter.jp