Skip to content

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

Open
@cretz

Description

@cretz

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions