diff options
| author | Ville Skyttä <ville.skytta@iki.fi> | 2016-07-27 09:34:09 +0300 |
|---|---|---|
| committer | Ville Skyttä <ville.skytta@iki.fi> | 2016-07-27 09:34:09 +0300 |
| commit | f957c812ac3221773058ba2fa8cd38017537da8a (patch) | |
| tree | 25e1d8b81197ee3d2a3267ead992e5dbd86b335e /gitdb/db | |
| parent | d1996e04dbf4841b853b60c1365f0f5fd28d170c (diff) | |
| download | gitdb-f957c812ac3221773058ba2fa8cd38017537da8a.tar.gz | |
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 |
