KEMBAR78
Treat generators with await as async. by jhance · Pull Request #12925 · python/mypy · GitHub
Skip to content

Conversation

jhance
Copy link
Collaborator

@jhance jhance commented Jun 2, 2022

Fixes #12924 by using a traverser to find await expressions within a generator and then treat it as async if it is found.

A test is added. The test fails without this patch because the function has type Generator inferred, not AsyncGenerator.

@jhance jhance requested a review from JukkaL June 2, 2022 01:39
@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

Copy link
Member

@ilevkivskyi ilevkivskyi left a comment

Choose a reason for hiding this comment

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

Thanks for the fix!

@github-actions
Copy link
Contributor

github-actions bot commented Jun 2, 2022

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

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.

Mypy misunderstands poorly documented class of async generators

2 participants