This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Add __exit__() method to event loops
Type: enhancement Stage: resolved
Components: asyncio Versions: Python 3.8
process
Status: closed Resolution: rejected
Dependencies: Superseder: Make event loops with statement context managers
View: 24795
Assigned To: Nosy List: asvetlov, martin.panter, porton, terry.reedy, yselivanov
Priority: normal Keywords:

Created on 2018-02-19 18:43 by porton, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (5)
msg312360 - (view) Author: Victor Porton (porton) Date: 2018-02-19 18:43
Please add `__exit__()` method to event loops, to use them with `with`.
msg312675 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-02-24 00:12
Enhancements only go in future releases not yet in beta.

Do loops already have an __enter__ method, also required for with?  What would you have the close method do?  Preemptorially cancel all tasks and close the loop?  With statement are usually for ensuring deterministic cleanup after the last substatement, such as closing a file.  Can you give a short usage example?
msg312677 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2018-02-24 00:27
Maybe already discussed in Issue 24795?
msg312692 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-02-24 02:39
A. Svetlov, closing #24795: "Superseded by `asyncio.run()` function."
msg312917 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2018-02-26 11:14
Agree
History
Date User Action Args
2022-04-11 14:58:57adminsetgithub: 77056
2018-02-26 11:14:26asvetlovsetmessages: + msg312917
2018-02-24 02:39:47terry.reedysetstatus: open -> closed
resolution: rejected
messages: + msg312692

stage: resolved
2018-02-24 00:27:18martin.pantersetsuperseder: Make event loops with statement context managers

messages: + msg312677
nosy: + martin.panter
2018-02-24 00:12:55terry.reedysetnosy: + terry.reedy

messages: + msg312675
versions: + Python 3.8, - Python 3.6
2018-02-19 18:43:31portoncreate