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

Use loop.create_task with interact() #270

Merged
merged 4 commits into from
Jun 22, 2022
Merged

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.

jupyter_console/ptshell.py Outdated Show resolved Hide resolved
jupyter_console/ptshell.py Outdated Show resolved Hide resolved
@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?

setup.py Outdated Show resolved Hide resolved
setup.py Outdated Show resolved Hide resolved
@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