You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Required changes to run: Change repo_path to any directory with a git repository.
Explanation:
Opening a repository with pygit2.Repository and using a commit walker with repo.walk seems to keep the file handles over some .pack files in the repository. When I attempt to delete the repository afterwards with shutil.rmtree, I get an WinError 32 stating that the .pack files are blocked by another process. These file handles are not removed when deleting the pygit2.Repository object or the walker object. They can only be removed by explicitly calling Repository.free() or gc.collect().
Question:
Is this expected behavior, or should pygit2.Repository release these handles automatically when the Repository object is destroyed?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Environment:
Minimal example:
RepoWalkerFileHandles.py
Required changes to run: Change repo_path to any directory with a git repository.
Explanation:
Opening a repository with pygit2.Repository and using a commit walker with repo.walk seems to keep the file handles over some .pack files in the repository. When I attempt to delete the repository afterwards with shutil.rmtree, I get an WinError 32 stating that the .pack files are blocked by another process. These file handles are not removed when deleting the pygit2.Repository object or the walker object. They can only be removed by explicitly calling Repository.free() or gc.collect().
Question:
Is this expected behavior, or should pygit2.Repository release these handles automatically when the Repository object is destroyed?
All reactions