New submission from Jeff Kaufman <>:

With python built at HEAD (c51d8c9b) and at 3.7b3 (fcd4e03e08) the code:

    import difflib
    for fromdata, todata, flag in difflib._mdiff(
        ["2"], ["3"], 1):


    Traceback (most recent call last):
      File "/home/jefftk/cpython/Lib/", line 1638, in _mdiff
        from_line, to_line, found_diff = next(line_pair_iterator)

    The above exception was the direct cause of the following exception:

    Traceback (most recent call last):
      File "/home/jefftk/icdiff/", line 3, in <module>
        ["2"], ["3"], 1):
    RuntimeError: generator raised StopIteration

In python 3.5 and 3.6 I don't get an error.

This is probably due to which implements PEP 
479, but I this this isn't supposed to happen in library code?

components: Library (Lib)
messages: 314936
nosy: Jeff.Kaufman
priority: normal
severity: normal
status: open
title: "RuntimeError: generator raised StopIteration" in difflib.mdiff
type: behavior
versions: Python 3.7

Python tracker <>
Python-bugs-list mailing list

Reply via email to