Issue 30707: Incorrect description of "async with" in PEP492 and documentation (original) (raw)
The behaviour of the "async with" statement in CPython does not match the description of it in PEP492, 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".
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.