diff options
author | Sebastian Thiel <sebastian.thiel@icloud.com> | 2022-01-10 21:01:21 +0800 |
---|---|---|
committer | Sebastian Thiel <sebastian.thiel@icloud.com> | 2022-01-10 21:01:21 +0800 |
commit | e16a0040d07afa4ac9c0548aa742ec18ec1395a8 (patch) | |
tree | ba9b5f0a93dc46f08c7921007716b65a48c4e18f | |
parent | 53d22bbc14ed871991ef169b59770a4c5b3caa19 (diff) | |
download | gitpython-e16a0040d07afa4ac9c0548aa742ec18ec1395a8.tar.gz |
Assure index file descriptor is closed after reader (#1394) (#1395)
A regression that was introduced with d79d20d.
-rw-r--r-- | git/index/base.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/git/index/base.py b/git/index/base.py index d1f039cd..7cb77f15 100644 --- a/git/index/base.py +++ b/git/index/base.py @@ -135,7 +135,10 @@ class IndexFile(LazyMixin, git_diff.Diffable, Serializable): 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: |