Error with Python 3.10: "ValueError: loop argument must agree with lock"
See original GitHub issueI ran into this in my own project, see https://github.com/simonw/datasette/pull/1481 - then I tried using a fork of this project to run the unit tests against Python 3.10 and got the same error: https://github.com/simonw/janus/runs/3842463703?check_suite_focus=true
============================= test session starts ==============================
platform linux -- Python 3.10.0, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
rootdir: /home/runner/work/janus/janus
plugins: cov-2.12.1, asyncio-0.15.1
collected 72 items
tests/test_async.py FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF [ 43%]
tests/test_mixed.py .FFFFFFFFFFFFFFFFF [ 68%]
tests/test_sync.py FFFFFFFFFFFFFFFFFFFFFFF [100%]
=================================== FAILURES ===================================
__________________________ TestQueueBasic.test_empty ___________________________
self = <test_async.TestQueueBasic object at 0x7fb0f561e4d0>
@pytest.mark.asyncio
async def test_empty(self):
> _q = janus.Queue()
tests/test_async.py:65:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
janus/__init__.py:39: in __init__
self._async_not_empty = asyncio.Condition(self._async_mutex)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <[AttributeError("'Condition' object has no attribute 'locked'") raised in repr()] Condition object at 0x7fb0f569a620>
lock = <asyncio.locks.Lock object at 0x7fb0f569ada0 [unlocked]>
def __init__(self, lock=None, *, loop=mixins._marker):
super().__init__(loop=loop)
if lock is None:
lock = Lock()
elif lock._loop is not self._get_loop():
> raise ValueError("loop argument must agree with lock")
E ValueError: loop argument must agree with lock
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (9 by maintainers)
Top Results From Across the Web
"loop argument must agree with lock" instantiating asyncio ...
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 ......
Read more >Finding and reporting an asyncio bug in Python 3.10
Finding and reporting an asyncio bug in Python 3.10 ... Lock() # "loop argument must agree with lock" exception is raised here: self....
Read more >python 3.6 and ValueError: loop argument must agree with ...
I just want to run a simple test example yet I get the below error. How do I resolve?
Read more >Python: Lib/asyncio/locks.py - Fossies
_loop = loop 84 warnings.warn("The loop argument is deprecated since Python 3.8, " 85 "and scheduled for removal in Python 3.10.
Read more >Python 3.10: Cool New Features for You to Try
In this tutorial, you'll learn about: Debugging with more helpful and precise error messages; Using structural pattern matching to work with data structures ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

janus 0.6.2 released with the fix
That addressed the bug!