Skip to content

"Assertion failed" when iterating over nested tree objects #985

Description

@lorencarvalho

Hi there,

I'm not sure what exactly is causing this, but I was attempting to iterate over all of the files in a given commit using the tree objects and I am hitting a seg fault:

>>> def iter_tree(tree):
...     for e in tree:
...         if isinstance(e, Blob):
...             yield e.name
...         elif isinstance(e, Tree):
...             yield from iter_tree(e)
...

>>> c
<_pygit2.Commit at 0x107e910c0>

>>> iter_tree(c.tree)
<generator object iter_tree at 0x109193050>

>>> list(iter_tree(c.tree))
Assertion failed: (tree), function git_tree_entry_byindex, file libgit2/src/tree.c, line 317.
Abort trap: 6

Not sure what could be causing this, thanks for looking!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions