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

Improved validation of generator return type. Previously, the check w… #5973

Closed
wants to merge 1 commit into from

Conversation

erictraut
Copy link
Collaborator

…as performed only for yield statements, but it's possible to define a generator function that has no reachable yield statements. This addresses #5972.

…as performed only for `yield` statements, but it's possible to define a generator function that has no reachable yield statements. This addresses #5972.
@github-actions
Copy link
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

steam.py (https://github.com/Gobot1234/steam.py)
+   /tmp/mypy_primer/projects/steam.py/steam/utils.py:734:65 - error: Return type of generator function must be compatible with "Generator[Any, Any, Any]"
+     "Generator[Any, Any, Any]" is incompatible with "AsyncGenerator[tuple[_T@as_chunks, ...], None]" (reportGeneralTypeIssues)
- 7960 errors, 23 warnings, 0 informations 
+ 7961 errors, 23 warnings, 0 informations 

dd-trace-py (https://github.com/DataDog/dd-trace-py)
+   /tmp/mypy_primer/projects/dd-trace-py/tests/contrib/asyncpg/test_asyncpg.py:24:11 - error: Return type of async generator function must be compatible with "AsyncGenerator[Any, Any]"
+     "AsyncGenerator[Any, Any, Any]" is incompatible with "Generator[Unknown, None, None]" (reportGeneralTypeIssues)
- 9093 errors, 467 warnings, 0 informations 
+ 9094 errors, 467 warnings, 0 informations 

@erictraut erictraut closed this Sep 18, 2023
@erictraut erictraut deleted the issue5972 branch September 18, 2023 20:45
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.

2 participants