[New-bugs-announce] [issue45416] "loop argument must agree with lock" instantiating asyncio.Condition
Simon Willison
report at bugs.python.org
Fri Oct 8 16:30:58 EDT 2021
New submission from Simon Willison <swillison at gmail.com>:
In Python 3.10 it is not possible to instantiate an asyncio.Condition that wraps an asyncio.Lock without raising a "loop argument must agree with lock" exception.
This code raises that exception:
asyncio.Condition(asyncio.Lock())
This worked in previous Python versions.
Note that the error only occurs if an event loop is running. Here's a simple script that replicates the problem:
import asyncio
# This runs without an exception:
print(asyncio.Condition(asyncio.Lock()))
# This does not work:
async def example():
print(asyncio.Condition(asyncio.Lock()))
# This raises "ValueError: loop argument must agree with lock":
asyncio.run(example())
----------
components: asyncio
messages: 403500
nosy: asvetlov, simonw, yselivanov
priority: normal
severity: normal
status: open
title: "loop argument must agree with lock" instantiating asyncio.Condition
versions: Python 3.10
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45416>
_______________________________________
More information about the New-bugs-announce
mailing list