Fix async iterator body stripping#15491
Merged
JukkaL merged 5 commits intopython:masterfrom Jun 23, 2023
Merged
Conversation
for more information, see https://pre-commit.ci
ilevkivskyi
approved these changes
Jun 21, 2023
| and self.strip_function_bodies | ||
| and len(stack) == 1 | ||
| and stack[0] == "F" | ||
| and not is_coroutine |
Member
There was a problem hiding this comment.
We can strip if there is no yield right? Also IIUC this is the actual fix, while the change below is just a refactoring, right?
Collaborator
Author
There was a problem hiding this comment.
Change below isn't just refactoring, since the stripping below used to only happen in methods.
Member
There was a problem hiding this comment.
OK, wait, but then now the stripping in last part will occur even if stack[0] != "F", is it safe?
Collaborator
Author
There was a problem hiding this comment.
Added that check, and fixed a bug I introduced in the logic for empty bodies
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Collaborator
Author
|
I added the reporting repo to primer and hit update branch, so hopefully diff will show up. |
Contributor
|
Diff from mypy_primer, showing the effect of this PR on open source code: vision (https://github.com/pytorch/vision): typechecking got 1.28x slower (38.1s -> 48.9s)
(Performance measurements are based on a single noisy sample)
aiohttp-devtools (https://github.com/aio-libs/aiohttp-devtools)
- aiohttp_devtools/runserver/watch.py:70: error: "Coroutine[Any, Any, AsyncGenerator[set[tuple[Change, str]], None]]" has no attribute "__aiter__" (not async iterable) [attr-defined]
- aiohttp_devtools/runserver/watch.py:70: note: Maybe you forgot to use "await"?
- aiohttp_devtools/runserver/watch.py:147: error: "Coroutine[Any, Any, AsyncGenerator[set[tuple[Change, str]], None]]" has no attribute "__aiter__" (not async iterable) [attr-defined]
- aiohttp_devtools/runserver/watch.py:147: note: Maybe you forgot to use "await"?
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #15489