Issue32314
Created on 2017-12-13 21:47 by yselivanov, last changed 2018-01-21 19:57 by yselivanov. This issue is now closed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 4852 | merged | yselivanov, 2017-12-13 21:48 | |
| PR 5262 | open | yselivanov, 2018-01-21 18:18 | |
| Messages (7) | |||
|---|---|---|---|
| msg308256 - (view) | Author: Yury Selivanov (yselivanov) * | Date: 2017-12-13 21:47 | |
There's a fairly extensive discussion here: https://github.com/python/asyncio/pull/465 In short, asyncio.run() is a pretty straightforward addition, so let's add it. The discussion was more focused on the asyncio.run_forever() proposal. I now think that it shouldn't be implemented in asyncio. Instead we should fix cases where 'loop.run_forever' is usually required. Mainly that's servers, and they are easily fixable by making "Server" an async context manager and implementing a "server.serve_forever()" method. That way, with asyncio.run(): async def serve_something(): async with asyncio.start_server(...) as server: await server.serve_forever() asyncio.run(serve_something()) # No loop.run_forever()! |
|||
| msg308258 - (view) | Author: Andrew Svetlov (asvetlov) * | Date: 2017-12-13 22:05 | |
I like avoiding run_forever() -- the function always was too cumbersome. |
|||
| msg308259 - (view) | Author: Yury Selivanov (yselivanov) * | Date: 2017-12-13 22:07 | |
I'll open a separate issue to improve Server's API. AFAIK it's the main reason for having run_forever(). |
|||
| msg308301 - (view) | Author: Yury Selivanov (yselivanov) * | Date: 2017-12-14 14:42 | |
New changeset 02a0a19206da6902c3855a1fa09e60b208474cfa by Yury Selivanov in branch 'master': bpo-32314: Implement asyncio.run() (#4852) https://github.com/python/cpython/commit/02a0a19206da6902c3855a1fa09e60b208474cfa |
|||
| msg308303 - (view) | Author: STINNER Victor (vstinner) * | Date: 2017-12-14 14:45 | |
Wow, I really love your new function. Thanks Yury! asyncio examples in the doc look much better now! |
|||
| msg308308 - (view) | Author: Yury Selivanov (yselivanov) * | Date: 2017-12-14 15:35 | |
> Wow, I really love your new function. Thanks Yury! asyncio examples in the doc look much better now! This year I'll stay for the sprints at PyCon, and will focus on improving the docs further. I needed asyncio.run for that :) |
|||
| msg310381 - (view) | Author: Yury Selivanov (yselivanov) * | Date: 2018-01-21 19:57 | |
New changeset a4afcdfa55ddffa4b9ae3b0cf101628c7bff4102 by Yury Selivanov in branch 'master': bpo-32314: Fix asyncio.run() to cancel runinng tasks on shutdown (#5262) https://github.com/python/cpython/commit/a4afcdfa55ddffa4b9ae3b0cf101628c7bff4102 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2018-01-21 19:57:01 | yselivanov | set | messages: + msg310381 |
| 2018-01-21 18:18:29 | yselivanov | set | pull_requests: + pull_request5107 |
| 2017-12-14 15:35:15 | yselivanov | set | messages: + msg308308 |
| 2017-12-14 14:45:16 | vstinner | set | nosy:
+ vstinner messages: + msg308303 |
| 2017-12-14 14:43:04 | yselivanov | set | status: open -> closed resolution: fixed stage: patch review -> resolved |
| 2017-12-14 14:42:24 | yselivanov | set | messages: + msg308301 |
| 2017-12-13 22:07:44 | yselivanov | set | messages: + msg308259 |
| 2017-12-13 22:05:32 | asvetlov | set | messages: + msg308258 |
| 2017-12-13 21:48:25 | yselivanov | set | keywords:
+ patch stage: patch review pull_requests: + pull_request4741 |
| 2017-12-13 21:47:08 | yselivanov | create | |