This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author simonw
Recipients asvetlov, simonw, yselivanov
Date 2021-10-08.20:30:58
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1633725058.57.0.682695156248.issue45416@roundup.psfhosted.org>
In-reply-to
Content
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())
History
Date User Action Args
2021-10-08 20:30:58simonwsetrecipients: + simonw, asvetlov, yselivanov
2021-10-08 20:30:58simonwsetmessageid: <1633725058.57.0.682695156248.issue45416@roundup.psfhosted.org>
2021-10-08 20:30:58simonwlinkissue45416 messages
2021-10-08 20:30:58simonwcreate