'await' in non-async function is a blocking error, fixes #15339 by gregorysantosa · Pull Request #15384 · python/mypy (original) (raw)

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 andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation8 Commits12 Checks0 Files changed

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

gregorysantosa

Fixes, #15339

Added a new error code AWAIT_NOT_ASYNC to address awaits in non-async functions as a blocking error. Then I assigned the error code to an error print in visit_await_expr and removed the blocker flag.

I modified the testInvalidComprehensionNoCrash test case within the check-async-await.test file to reflect the updated error message for await statements not located within async functions.

@gregorysantosa

…nt' for test cases and the error print in mypy/message_registry.py

@gregorysantosa

@gregorysantosa

…pe comment' for test cases and the error print in mypy/message_registry.py"

This reverts commit 6080839.

@gregorysantosa

…or in type comment' for test cases and the error print in mypy/message_registry.py""

This reverts commit f468fbb.

@gregorysantosa

…d syntax'"

This reverts commit ce7f920.

@gregorysantosa

…'syntax error'->'Syntax error' change. Currently only Syntax error has been changed from the main branch

@gregorysantosa

@gregorysantosa

…in an ASYNC function definition

@gregorysantosa

@pre-commit-ci

@gregorysantosa

@gregorysantosa

@gregorysantosa gregorysantosa changed the title'await' in non-async function is a blocking error, refs #15339 'await' in non-async function is a blocking error, fixes #15339

Jun 7, 2023

@github-actions

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

hauntsaninja

Choose a reason for hiding this comment

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

Thanks for fixing this!

@AlexWaygood

@ilevkivskyi

I am curious why the build didn't fail on the PR, and failed only after merge on master.

@AlexWaygood

I am curious why the build didn't fail on the PR, and failed only after merge on master.

Because it was an old PR, that predated the new docs check, and master had not been merged into the PR branch since the new docs check had been introduced

@ilevkivskyi

@hauntsaninja

@gregorysantosa

Sorry for not replying to this, I took a break from the internet for a while. I will be more active here from here on out! Thank you.