libgit2/pygit2

Weird ref count of Repository obj when access remotes

shinningstar opened this issue · 1 comments

image

In method 'refresh', a whole new Repository object has been created and the old one should be deconstructed. But in fact, that not happen. Why?

Thanks for reporting.

This the code I have used to verify this bug is fixed:

from pygit2 import Repository
import sys

if __name__ == '__main__':
    repo = Repository('/home/jdavid/sandboxes/itools/.git')
    print sys.getrefcount(repo)
    repo.remotes
    print sys.getrefcount(repo)

If run with pygit2 v0.20.1 the output is:

2
5

If run with latest checkout of pygit2 the output is:

2
2