Skip to content

blame_incremental raises RuntimeError with Python 3.7 #794

Closed
@dschopf

Description

@dschopf

After upgrading to Python 3.7 the Repo.Base.blame_incremental iterator raises a RuntimeError.

This is probably due to https://www.python.org/dev/peps/pep-0479/.

This is running on latest Arch Linux x86_64 testing, using the following package versions:
python: 3.7.0-3, git: 2.19.0-1, python-git: python-gitpython 2.1.11-2

It can be reproduced with the following code:

#!/usr/bin/env python3
# coding: utf-8

import git

git_repo = git.Repo('.')
blame_list = list(git_repo.blame_incremental('@', 'package.sh', w=True))

Result:

$ ./test.py
Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/git/repo/base.py", line 717, in blame_incremental
    line = next(stream)  # when exhausted, causes a StopIteration, terminating this function
StopIteration

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

Traceback (most recent call last):
  File "./test.py", line 7, in <module>
    blame_list = list(git_repo.blame_incremental('@', 'package.sh', w=True))
RuntimeError: generator raised StopIteration

Running this script in Python < 3.7 works as expected and does not raise the exception.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions