diff options
| author | Sebastian Thiel <byronimo@gmail.com> | 2016-07-30 16:43:48 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-07-30 16:43:48 +0200 |
| commit | 58cfb7e21253287240f24290e69c00e5e119c400 (patch) | |
| tree | aee6ea858fd1e828908b96735239ea24693efa8a /gitdb/db | |
| parent | 40ec1fa3a2cfad1ace13f801a35364e9ec050d7f (diff) | |
| parent | f957c812ac3221773058ba2fa8cd38017537da8a (diff) | |
| download | gitdb-58cfb7e21253287240f24290e69c00e5e119c400.tar.gz | |
Merge pull request #28 from scop/with
Handle more file open/close with "with"
Diffstat (limited to 'gitdb/db')
| -rw-r--r-- | gitdb/db/ref.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gitdb/db/ref.py b/gitdb/db/ref.py index 83a9f61..2e3db86 100644 --- a/gitdb/db/ref.py +++ b/gitdb/db/ref.py @@ -41,7 +41,8 @@ class ReferenceDB(CompoundDB): # try to get as many as possible, don't fail if some are unavailable ref_paths = list() try: - ref_paths = [l.strip() for l in open(self._ref_file, 'r').readlines()] + with open(self._ref_file, 'r') as f: + ref_paths = [l.strip() for l in f] except (OSError, IOError): pass # END handle alternates |
