[docs] [issue35826] Typo in example for async with statement with condition

Kevin Mai-Hsuan Chia report at bugs.python.org
Fri Jan 25 05:45:15 EST 2019


Kevin Mai-Hsuan Chia <kevin at 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 at bugs.python.org>
<https://bugs.python.org/issue35826>
_______________________________________


More information about the docs mailing list