Description
When I try to access a list of the repo config, python terminates abruptly with the message
Process finished with exit code -1073741819 (0xC0000005)
Example code that causes the issue:
import pygit2
repo = pygit2.Repository(path_to_git_repo)
items = list(repo.config)
for item in items:
print(item.name, item.value)
by comparison the following is fine:
import pygit2
repo = pygit2.Repository(path_to_git_repo)
items = repo.config
for item in items:
print(item.name, item.value)
and prints out the names and values of the configuration entries would be expected.
It isn't necessary to iterate over the list to cause the problem, the following will result in the same issue
items = list(repo.config)
print(items[0].name, items[0].value)
pygit2 version: 1.0.2
python version: 3.7.4 (64-bit)
OS version: Windows 10
Doing a little digging https://libgit2.org/libgit2/#HEAD/group/config/git_config_next
states "The pointers returned by this function are valid until the iterator is freed." The ConfigEntry object contains the pointer returned by git_config_next, so it seems these get freed when the iteration is complete, and the ConfigEntry elements of the list are left pointing to invalid memory.