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

"RuntimeError: generator raised StopIteration" in difflib.mdiff #77405

Closed
JeffKaufman mannequin opened this issue Apr 4, 2018 · 5 comments
Closed

"RuntimeError: generator raised StopIteration" in difflib.mdiff #77405

JeffKaufman mannequin opened this issue Apr 4, 2018 · 5 comments
Assignees
Labels
3.7 (EOL) end of life 3.8 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@JeffKaufman
Copy link
Mannequin

JeffKaufman mannequin commented Apr 4, 2018

BPO 33224
Nosy @rhettinger
PRs
  • bpo-33224: PEP 479 fix for difflib.mdiff() #6381
  • [3.7] bpo-33224: PEP 479 fix for difflib.mdiff() (GH-6381) #6390
  • [3.6] bpo-33224: PEP 479 fix for difflib.mdiff() (GH-6381) #6391
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/rhettinger'
    closed_at = <Date 2018-04-05.19:23:50.574>
    created_at = <Date 2018-04-04.15:18:24.095>
    labels = ['3.7', '3.8', 'type-bug', 'library']
    title = '"RuntimeError: generator raised StopIteration" in difflib.mdiff'
    updated_at = <Date 2018-04-05.19:23:50.573>
    user = 'https://bugs.python.org/JeffKaufman'

    bugs.python.org fields:

    activity = <Date 2018-04-05.19:23:50.573>
    actor = 'rhettinger'
    assignee = 'rhettinger'
    closed = True
    closed_date = <Date 2018-04-05.19:23:50.574>
    closer = 'rhettinger'
    components = ['Library (Lib)']
    creation = <Date 2018-04-04.15:18:24.095>
    creator = 'Jeff.Kaufman'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 33224
    keywords = ['patch']
    message_count = 5.0
    messages = ['314936', '314999', '315001', '315003', '315004']
    nosy_count = 2.0
    nosy_names = ['rhettinger', 'Jeff.Kaufman']
    pr_nums = ['6381', '6390', '6391']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue33224'
    versions = ['Python 3.6', 'Python 3.7', 'Python 3.8']

    @JeffKaufman
    Copy link
    Mannequin Author

    JeffKaufman mannequin commented Apr 4, 2018

    With python built at HEAD (c51d8c9) and at 3.7b3 (fcd4e03) the code:

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

    produces:

        Traceback (most recent call last):
          File "/home/jefftk/cpython/Lib/difflib.py", line 1638, in _mdiff
            from_line, to_line, found_diff = next(line_pair_iterator)
        StopIteration
    
        The above exception was the direct cause of the following exception:
    
        Traceback (most recent call last):
          File "/home/jefftk/icdiff/repro.py", 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 https://bugs.python.org/issue32670 which implements PEP-479, but I this this isn't supposed to happen in library code?

    @JeffKaufman JeffKaufman mannequin added 3.7 (EOL) end of life stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Apr 4, 2018
    @rhettinger rhettinger self-assigned this Apr 5, 2018
    @rhettinger rhettinger added the 3.8 only security fixes label Apr 5, 2018
    @rhettinger
    Copy link
    Contributor

    New changeset 01b731f by Raymond Hettinger in branch 'master':
    bpo-33224: PEP-479 fix for difflib.mdiff() (GH-6381)
    01b731f

    @rhettinger
    Copy link
    Contributor

    New changeset 28c1790 by Raymond Hettinger (Miss Islington (bot)) in branch '3.7':
    bpo-33224: PEP-479 fix for difflib.mdiff() (GH-6381) (GH-6390)
    28c1790

    @rhettinger
    Copy link
    Contributor

    New changeset 8da15f0 by Raymond Hettinger (Miss Islington (bot)) in branch '3.6':
    bpo-33224: PEP-479 fix for difflib.mdiff() (GH-6381) (GH-6391)
    8da15f0

    @rhettinger
    Copy link
    Contributor

    Thanks for timely report. I appreciate you exercising the beta release to shake out bugs.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life 3.8 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant