Skip to content

Incorrect description of "async with" in PEP492 and documentation #74892

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

Closed
DamienGeorge mannequin opened this issue Jun 20, 2017 · 3 comments
Closed

Incorrect description of "async with" in PEP492 and documentation #74892

DamienGeorge mannequin opened this issue Jun 20, 2017 · 3 comments
Labels
3.7 (EOL) end of life docs Documentation in the Doc dir type-bug An unexpected behavior, bug, or error

Comments

@DamienGeorge
Copy link
Mannequin

DamienGeorge mannequin commented Jun 20, 2017

BPO 30707
Nosy @ncoghlan, @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 = None
created_at = <Date 2017-06-20.04:34:20.751>
labels = ['type-bug', '3.7', 'docs']
title = 'Incorrect description of "async with" in PEP492 and documentation'
updated_at = <Date 2017-06-20.05:38:31.725>
user = 'https://bugs.python.org/DamienGeorge'

bugs.python.org fields:

activity = <Date 2017-06-20.05:38:31.725>
actor = 'ncoghlan'
assignee = 'docs@python'
closed = False
closed_date = None
closer = None
components = ['Documentation']
creation = <Date 2017-06-20.04:34:20.751>
creator = 'Damien George'
dependencies = []
files = []
hgrepos = []
issue_num = 30707
keywords = []
message_count = 2.0
messages = ['296400', '296402']
nosy_count = 4.0
nosy_names = ['ncoghlan', 'docs@python', 'yselivanov', 'Damien George']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue30707'
versions = ['Python 3.5', 'Python 3.6', 'Python 3.7']

@DamienGeorge DamienGeorge mannequin added the 3.7 (EOL) end of life label Jun 20, 2017
@DamienGeorge DamienGeorge mannequin assigned docspython Jun 20, 2017
@DamienGeorge DamienGeorge mannequin added docs Documentation in the Doc dir type-bug An unexpected behavior, bug, or error labels Jun 20, 2017
@DamienGeorge
Copy link
Mannequin Author

DamienGeorge mannequin commented Jun 20, 2017

The behaviour of the "async with" statement in CPython does not match the description of it in PEP-492, nor the language documentation. The implementation uses a try/except/finally block, while the PEP and documentation describe the behaviour using a try/except/else block. The PEP and documentation should be updated to reflect the true intention of "async with".

@ncoghlan
Copy link
Contributor

The specific issue is that early exits from an "async with" statement are actually defined the same way they for synchronous with statements: exiting early via return, break, or continue, is the same as reaching the end of the try block.

However, that's not what the documentation currently says: it describes "async with" in terms of try/except/else, which isn't correct.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
@slateny
Copy link
Contributor

slateny commented May 13, 2022

This looks resolved to me - language reference's been updated with finally, and regarding the pep I opened an issue here on the pep repo for discussion there.

@slateny slateny closed this as completed May 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.7 (EOL) end of life docs Documentation in the Doc dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants