Skip to content

asyncio.wait() no longer accepts the loop keyword in Python 3.10 #245

@hroncok

Description

@hroncok

Hello. The code in here:

main_task = asyncio.wait(tasks, loop=loop, return_when=asyncio.FIRST_COMPLETED)

Fails with this on Python 3.10:

$ jupyter-console 
Jupyter console 6.4.0

Python 3.10.0b3 (default, Jun 17 2021, 00:00:00) [GCC 11.1.1 20210617 (Red Hat 11.1.1-5)]
Type 'copyright', 'credits' or 'license' for more information
IPython 7.24.1 -- An enhanced Interactive Python. Type '?' for help.
Traceback (most recent call last):
  File "/usr/bin/jupyter-console", line 33, in <module>
    sys.exit(load_entry_point('jupyter-console==6.4.0', 'console_scripts', 'jupyter-console')())
  File "/usr/lib/python3.10/site-packages/jupyter_core/application.py", line 254, in launch_instance
    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
  File "/usr/lib/python3.10/site-packages/traitlets/config/application.py", line 845, in launch_instance
    app.start()
  File "/usr/lib/python3.10/site-packages/jupyter_console/app.py", line 148, in start
    self.shell.mainloop()
  File "/usr/lib/python3.10/site-packages/jupyter_console/ptshell.py", line 664, in mainloop
    main_task = asyncio.wait(tasks, loop=loop, return_when=asyncio.FIRST_COMPLETED)
TypeError: wait() got an unexpected keyword argument 'loop'
sys:1: RuntimeWarning: coroutine 'ZMQTerminalInteractiveShell.interact' was never awaited
<mock-chroot> sh-5.1$ [IPKernelApp] WARNING | Parent appears to have exited, shutting down.
^C

The issue is that asyncio.wait() no longer accepts the loop keyword in python 3.10; see https://docs.python.org/3.10/library/asyncio-task.html#waiting-primitives.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions