[issue35826] Typo in example for async with statement with condition
New submission from Kevin Mai-Hsuan Chia <kevin@mhchia.com>: In the [example](https://docs.python.org/3.8/library/asyncio-sync.html#asyncio.Condition) of the equivalent code to the `async with statement`: ```python cond = asyncio.Condition() # ... later await lock.acquire() try: await cond.wait() finally: lock.release() ``` `lock.acquire()` should be replaced by `cond.acquire()`, and `lock.release()` replaced by `cond.release()`. So the resulting code snippet becomes: ```python cond = asyncio.Condition() # ... later await cond.acquire() try: await cond.wait() finally: cond.release() ``` ---------- assignee: docs@python components: Documentation messages: 334349 nosy: docs@python, mhchia priority: normal severity: normal status: open title: Typo in example for async with statement with condition type: enhancement versions: Python 3.8 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue35826> _______________________________________
Kevin Mai-Hsuan Chia <kevin@mhchia.com> added the comment: In the [example](https://docs.python.org/3.8/library/asyncio-sync.html#asyncio.Condition) of the equivalent code to the `async with` statement: ```python cond = asyncio.Condition() # ... later await lock.acquire() try: await cond.wait() finally: lock.release() ``` `lock.acquire()` should be replaced by `cond.acquire()`, and `lock.release()` replaced by `cond.release()`. So the resulting code snippet becomes: ```python cond = asyncio.Condition() # ... later await cond.acquire() try: await cond.wait() finally: cond.release() ``` ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue35826> _______________________________________
Yury Selivanov <yselivanov@gmail.com> added the comment: Please submit a PR! ---------- components: +asyncio -Documentation keywords: +easy nosy: +asvetlov, yselivanov _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue35826> _______________________________________
Change by Carol Willing <willingc@gmail.com>: ---------- nosy: +willingc _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue35826> _______________________________________
Change by Kevin Mai-Hsuan Chia <kevin@mhchia.com>: ---------- keywords: +patch pull_requests: +11511 stage: -> patch review _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue35826> _______________________________________
Change by Kevin Mai-Hsuan Chia <kevin@mhchia.com>: ---------- keywords: +patch, patch pull_requests: +11511, 11512 stage: -> patch review _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue35826> _______________________________________
Change by Kevin Mai-Hsuan Chia <kevin@mhchia.com>: ---------- keywords: +patch, patch, patch pull_requests: +11511, 11512, 11514 stage: -> patch review _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue35826> _______________________________________
Change by Kevin Mai-Hsuan Chia <kevin@mhchia.com>: ---------- keywords: +patch, patch, patch, patch pull_requests: +11511, 11512, 11513, 11514 stage: -> patch review _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue35826> _______________________________________
Emmanuel Arias <emmanuelarias30@gmail.com> added the comment: This issue could be closed, right? ---------- nosy: +eamanu _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue35826> _______________________________________
Kevin Mai-Hsuan Chia <kevin@mhchia.com> added the comment: Cool! Thanks for the reminder. ---------- stage: patch review -> resolved status: open -> closed _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue35826> _______________________________________
Change by miss-islington <mariatta.wijaya+miss-islington@gmail.com>: ---------- pull_requests: +16297 pull_request: https://github.com/python/cpython/pull/16720 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue35826> _______________________________________
participants (5)
-
Carol Willing
-
Emmanuel Arias
-
Kevin Mai-Hsuan Chia
-
miss-islington
-
Yury Selivanov