New submission from Simon Willison <[email protected]>:
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 <[email protected]>
<https://bugs.python.org/issue45416>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com