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

async/await syntax #103

Merged
merged 2 commits into from
May 13, 2021
Merged

async/await syntax #103

merged 2 commits into from
May 13, 2021

Conversation

minrk
Copy link
Member

@minrk minrk commented May 13, 2021

requiring Python 3.6 means we can drop some old syntax and simplify things

  • @gen.coroutine -> async def
  • yield-> await
  • raise gen.Return(result) -> return result

includes #102

This shouldn't change any behavior, other than the fact that some methods can now be called in any asyncio context instead of requiring tornado.

The main consequence is when there's a bug where a coroutine is missing an await, the given coroutine will actually not start, rather than tornado's coroutine behavior where calling a coroutine is closer to the equivalent of asyncio.Task(coroutine()), scheduling it immediately. I think I found one such example in the tests.

minrk added 2 commits May 13, 2021 13:55
grab current reference as requested

improves compatibility with current tornado, avoids stale handles if IOLoop changes
between instantiation and starting events
requiring Python 3.6 means we can drop some old syntax and simplify things

- @gen.coroutine -> async def
- yield -> await
- raise gen.Return(result) -> return result
Copy link
Contributor

@blink1073 blink1073 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@blink1073 blink1073 merged commit 55f0fd8 into jupyter:master May 13, 2021
@minrk minrk deleted the async-await branch May 14, 2021 10:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants