pyscript icon indicating copy to clipboard operation
pyscript copied to clipboard

"async with" statement fails without target variable assignment

Open dmamelin opened this issue 1 year ago • 0 comments

This code causes an error: RuntimeError: Lock is not acquired.

lock = asyncio.Lock()
async with lock:
    pass

Workaround:

lock = asyncio.Lock()
async with lock as lock_test:
    pass

dmamelin avatar Feb 01 '24 01:02 dmamelin