Skip to content
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

asyncio: add support for async context manager on streams? #70561

Closed
vstinner opened this issue Feb 17, 2016 · 4 comments
Closed

asyncio: add support for async context manager on streams? #70561

vstinner opened this issue Feb 17, 2016 · 4 comments
Labels
topic-asyncio type-feature A feature request or enhancement

Comments

@vstinner
Copy link
Member

BPO 26373
Nosy @gvanrossum, @vstinner, @vadmium, @1st1

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2017-06-28.01:11:31.754>
created_at = <Date 2016-02-17.11:30:21.910>
labels = ['type-feature', 'expert-asyncio']
title = 'asyncio: add support for async context manager on streams?'
updated_at = <Date 2017-06-28.01:11:31.752>
user = 'https://github.com/vstinner'

bugs.python.org fields:

activity = <Date 2017-06-28.01:11:31.752>
actor = 'vstinner'
assignee = 'none'
closed = True
closed_date = <Date 2017-06-28.01:11:31.754>
closer = 'vstinner'
components = ['asyncio']
creation = <Date 2016-02-17.11:30:21.910>
creator = 'vstinner'
dependencies = []
files = []
hgrepos = []
issue_num = 26373
keywords = []
message_count = 4.0
messages = ['260394', '267201', '267243', '297105']
nosy_count = 5.0
nosy_names = ['gvanrossum', 'vstinner', 'python-dev', 'martin.panter', 'yselivanov']
pr_nums = []
priority = 'normal'
resolution = 'out of date'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue26373'
versions = ['Python 3.6']

@vstinner
Copy link
Member Author

While working on the issue bpo-24911 (Context manager of socket.socket is not documented), I recalled that asyncio objects don't support context manager. With the PEP-492, it becomes possible to add support for async context manager for a few asyncio objects. I suggest to start with StreamWriter.

Usually, my rationale to decide which object should implement context manager is to check if the destructor can emit ResourceWarning.

In asyncio, ResourceWarning is now emitted by transport and event loop destructors:
https://docs.python.org/dev/library/asyncio-dev.html#close-transports-and-event-loops

@vstinner vstinner added topic-asyncio type-feature A feature request or enhancement labels Feb 17, 2016
@python-dev
Copy link
Mannequin

python-dev mannequin commented Jun 4, 2016

New changeset 883cfb3e28f9 by Gregory P. Smith in branch '3.5':
Fixes Issue bpo-26373: subprocess.Popen.communicate now correctly ignores
https://hg.python.org/cpython/rev/883cfb3e28f9

New changeset 78e81de6d447 by Gregory P. Smith in branch 'default':
merge from 3.5 - Fixes Issue bpo-26373: subprocess.Popen.communicate
https://hg.python.org/cpython/rev/78e81de6d447

@vadmium
Copy link
Member

vadmium commented Jun 4, 2016

Above two commits were actuall for bpo-26372

@vstinner
Copy link
Member Author

I'm not sure asynico anymore and lost track of this issue, so I just close it.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic-asyncio type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants