bpo-33224: PEP 479 fix for difflib.mdiff()#6381
Conversation
| lines_to_write -= 1 | ||
| yield from_line, to_line, found_diff | ||
| except StopIteration: | ||
| # Catch exception from next() and return normally |
There was a problem hiding this comment.
It also catches exception from "yield". Is this intentionally?
There was a problem hiding this comment.
How does yield raise an exception? Also, my understanding is that any uncaught StopIteration in a generator is an error.
There was a problem hiding this comment.
yield can raise an exception passed by throw().
But I agree that in this case the generator is not leaked outside, and internally it is used only for iteration.
| lines_to_write -= 1 | ||
| yield from_line, to_line, found_diff | ||
| except StopIteration: | ||
| # Catch exception from next() and return normally |
There was a problem hiding this comment.
yield can raise an exception passed by throw().
But I agree that in this case the generator is not leaked outside, and internally it is used only for iteration.
|
Thanks @rhettinger for the PR 🌮🎉.. I'm working now to backport this PR to: 3.6, 3.7. |
|
GH-6390 is a backport of this pull request to the 3.7 branch. |
(cherry picked from commit 01b731f) Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
(cherry picked from commit 01b731f) Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
|
GH-6391 is a backport of this pull request to the 3.6 branch. |
https://bugs.python.org/issue33224