Skip to content

'await' in non-async function is a blocking error, fixes #15339#15384

Merged
hauntsaninja merged 12 commits intopython:masterfrom
gregorysantosa:master
Aug 12, 2023
Merged

'await' in non-async function is a blocking error, fixes #15339#15384
hauntsaninja merged 12 commits intopython:masterfrom
gregorysantosa:master

Conversation

@gregorysantosa
Copy link
Copy Markdown
Contributor

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 and others added 12 commits May 12, 2023 14:02
…nt' for test cases and the error print in mypy/message_registry.py
…pe comment' for test cases and the error print in mypy/message_registry.py"

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

This reverts commit f468fbb.
…'syntax error'->'Syntax error' change. Currently only Syntax error has been changed from the main branch
@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
Copy link
Copy Markdown
Contributor

github-actions bot commented Jun 7, 2023

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

Copy link
Copy Markdown
Collaborator

@hauntsaninja hauntsaninja 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 fixing this!

@AlexWaygood
Copy link
Copy Markdown
Member

AlexWaygood commented Aug 12, 2023

Looks like the docs build is failing on master as a result of this change: https://github.com/python/mypy/actions/runs/5840508131/job/15839825549

It's because there are no docs for the new await-not-async error code

@ilevkivskyi
Copy link
Copy Markdown
Member

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

@AlexWaygood
Copy link
Copy Markdown
Member

AlexWaygood commented Aug 12, 2023

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
Copy link
Copy Markdown
Member

OK, I see. @hauntsaninja @gregorysantosa Could you please add the docs for the new error code to unbreak master?

@hauntsaninja
Copy link
Copy Markdown
Collaborator

Fixed in #15858

@gregorysantosa
Copy link
Copy Markdown
Contributor Author

gregorysantosa commented Oct 14, 2023

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.

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.

4 participants