Skip to content

Commit

Permalink
Assure index file descriptor is closed after reader (#1394) (#1395)
Browse files Browse the repository at this point in the history
A regression that was introduced with d79d20d.
  • Loading branch information
Byron committed Jan 10, 2022
1 parent 53d22bb commit e16a004
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion git/index/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,10 @@ def _set_cache_(self, attr: str) -> None:
return None
# END exception handling

stream = file_contents_ro(fd, stream=True, allow_mmap=True)
try:
stream = file_contents_ro(fd, stream=True, allow_mmap=True)
finally:
os.close(fd)

self._deserialize(stream)
else:
Expand Down

0 comments on commit e16a004

Please sign in to comment.