Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Using < 3.10 on samples using global asyncio.Event fails #37

Open
cretz opened this issue Dec 14, 2022 · 0 comments
Open

[Bug] Using < 3.10 on samples using global asyncio.Event fails #37

cretz opened this issue Dec 14, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@cretz
Copy link
Member

cretz commented Dec 14, 2022

Describe the bug

asyncio.Event didn't get rid of its loop parameter (and defer loop lookup until use) until >= 3.10. So samples that instantiate an asyncio.Event() globally will get this when running in < 3.10:

Traceback (most recent call last):
  File "scratch\scratch.py", line 106, in <module>
    loop.run_until_complete(main())
  File "asyncio\base_events.py", line 616, in run_until_complete
  File "scratch\scratch.py", line 99, in main
    await interrupt_event.wait()
  File "asyncio\locks.py", line 309, in wait
RuntimeError: Task <Task pending name='Task-1' coro=<main() running at scratch\scratch.py:99> cb=[_run_until_complete_cb() at asyncio\base_events.py:184]> got Future <Future pending> attached to a different loop

Of course delaying creation of the event until after loop creation and passing in the now-removed loop kwarg in the event constructor fixes it.

We just need to find a better way to marry asyncio and signals across our samples.

@cretz cretz added the bug Something isn't working label Dec 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant