mirror of
https://github.com/python/cpython.git
synced 2025-07-07 19:35:27 +00:00
Issue 24237: Raise PendingDeprecationWarning per PEP 479
Raise PendingDeprecationWarning when generator raises StopIteration and no __future__ import is used. Fix offenders in the stdlib and tests. See also issue 22906. Thanks to Nick Coghlan and Berker Peksag for reviews.
This commit is contained in:
parent
e79ec70801
commit
683333955a
5 changed files with 78 additions and 29 deletions
|
@ -1582,7 +1582,10 @@ def _mdiff(fromlines, tolines, context=None, linejunk=None,
|
|||
while True:
|
||||
# Collecting lines of text until we have a from/to pair
|
||||
while (len(fromlines)==0 or len(tolines)==0):
|
||||
from_line, to_line, found_diff = next(line_iterator)
|
||||
try:
|
||||
from_line, to_line, found_diff = next(line_iterator)
|
||||
except StopIteration:
|
||||
return
|
||||
if from_line is not None:
|
||||
fromlines.append((from_line,found_diff))
|
||||
if to_line is not None:
|
||||
|
@ -1609,7 +1612,10 @@ def _mdiff(fromlines, tolines, context=None, linejunk=None,
|
|||
index, contextLines = 0, [None]*(context)
|
||||
found_diff = False
|
||||
while(found_diff is False):
|
||||
from_line, to_line, found_diff = next(line_pair_iterator)
|
||||
try:
|
||||
from_line, to_line, found_diff = next(line_pair_iterator)
|
||||
except StopIteration:
|
||||
return
|
||||
i = index % context
|
||||
contextLines[i] = (from_line, to_line, found_diff)
|
||||
index += 1
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue