Skip to content

Conversation

@encukou
Copy link
Contributor

@encukou encukou commented Jun 21, 2022

Passing coroutines directly to asyncio.wait is deprecated since Python 3.8, as it leads to confusing behavior.

In Python 3.11, wait() will no longer accept coroutines and must be given Tasks.

Passing coroutines directly to asyncio.wait is deprecated since
Python 3.8, as it leads to confusing behavior:
    https://docs.python.org/3.10/library/asyncio-task.html#asyncio-example-wait-coroutine
In Python 3.11, wait() no longer accepts coroutines and
must be given Tasks.
@hroncok
Copy link

hroncok commented Jun 21, 2022

I can confirm this actually works.

@davidbrochart
Copy link
Member

Thanks @encukou.
Maybe we could also get rid of asyncio.get_event_loop(), which is deprecated since Python 3.10. It will become an alias to asyncio.get_running_loop(), and this code will break.

@encukou
Copy link
Contributor Author

encukou commented Jun 22, 2022

OK, here's a bigger change: all the code that needs the loop moved to an async function, run by asyncio.run.

This makes several loop arguments unused, but I don't know if something depends on it being there, so I didn't remove it.

@encukou
Copy link
Contributor Author

encukou commented Jun 22, 2022

Is it OK to drop compatibility with Python 3.6?

@davidbrochart
Copy link
Member

Yes it is, do you also want to update setup.py?

@davidbrochart
Copy link
Member

Thanks a lot @encukou!

@davidbrochart davidbrochart merged commit 18cb350 into jupyter:main Jun 22, 2022
@encukou encukou deleted the create_task branch June 22, 2022 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants