-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Fix false positive in use-yield-from
when using yield
return
#9700
Conversation
If the return value from `yield` is inspected inline, such as by (augmented) assignment, changing the looped `yield` to `yield from` is very likely to change the semantics of the generator, since there is an implicit use of `generator.send`. Closes pylint-dev#9696
Codecov ReportAll modified and coverable lines are covered by tests β
Additional details and impacted files@@ Coverage Diff @@
## main #9700 +/- ##
=======================================
Coverage 95.84% 95.84%
=======================================
Files 174 174
Lines 18862 18862
=======================================
Hits 18078 18078
Misses 784 784
|
π€ According to the primer, this change has no effect on the checked open source code. π€π This comment was generated for commit 7222319 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you ! We're going to release this in the next patch release (3.2.3).
β¦) (#9701) If the return value from `yield` is inspected inline, such as by (augmented) assignment, changing the looped `yield` to `yield from` is very likely to change the semantics of the generator, since there is an implicit use of `generator.send`. Closes #9696 (cherry picked from commit ea73bae) Co-authored-by: Jake Lishman <[email protected]>
Type of Changes
Description
If the return value from
yield
is inspected inline, such as by (augmented) assignment, changing the loopedyield
toyield from
is very likely to change the semantics of the generator, since there is an implicit use ofgenerator.send
.The type-hint component of #9696 feels (to me) like it would be suitable to suppress with a local lint suppression rather than complex type inference within pylint; it's a pretty unusual construction.
Closes #9696