classification
Title: Typo in example for async with statement with condition
Type: enhancement Stage: patch review
Components: asyncio Versions: Python 3.8
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: asvetlov, docs@python, mhchia, willingc, yselivanov
Priority: normal Keywords: easy, patch, patch, patch, patch

Created on 2019-01-25 10:44 by mhchia, last changed 2019-01-26 05:54 by mhchia.

Pull Requests
URL Status Linked Edit
PR 11681 merged mhchia, 2019-01-26 05:54
PR 11681 merged mhchia, 2019-01-26 05:54
PR 11681 merged mhchia, 2019-01-26 05:54
PR 11681 merged mhchia, 2019-01-26 05:54
Messages (3)
msg334349 - (view) Author: Kevin Mai-Hsuan Chia (mhchia) * Date: 2019-01-25 10:44
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()
```
msg334350 - (view) Author: Kevin Mai-Hsuan Chia (mhchia) * Date: 2019-01-25 10:45
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()
```
msg334376 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) Date: 2019-01-25 23:10
Please submit a PR!
History
Date User Action Args
2019-01-26 05:55:05mhchiasetkeywords: + patch
stage: patch review
pull_requests: + pull_request11513
2019-01-26 05:54:58mhchiasetkeywords: + patch
stage: (no value)
pull_requests: + pull_request11514
2019-01-26 05:54:50mhchiasetkeywords: + patch
stage: (no value)
pull_requests: + pull_request11512
2019-01-26 05:54:41mhchiasetkeywords: + patch
stage: (no value)
pull_requests: + pull_request11511
2019-01-25 23:45:50willingcsetnosy: + willingc
2019-01-25 23:10:28yselivanovsetnosy: + asvetlov, yselivanov
messages: + msg334376

components: + asyncio, - Documentation
keywords: + easy
2019-01-25 10:45:14mhchiasetmessages: + msg334350
2019-01-25 10:44:12mhchiacreate