diff options
author | Alex Morega <alex@grep.ro> | 2013-07-05 15:57:25 +0200 |
---|---|---|
committer | Alex Morega <alex@grep.ro> | 2013-07-05 15:58:40 +0200 |
commit | fc34cb04f4cc406034078fc1f42e5c193c3868b3 (patch) | |
tree | 3be88019d581a8091cf2665db6d3481a743522fa /babel/support.py | |
parent | 60917d2de26760c579c51da9774dce394b6b35d5 (diff) | |
download | babel-fc34cb04f4cc406034078fc1f42e5c193c3868b3.tar.gz |
make sure we close the file
Diffstat (limited to 'babel/support.py')
-rw-r--r-- | babel/support.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/babel/support.py b/babel/support.py index 80f015c..1f2efc2 100644 --- a/babel/support.py +++ b/babel/support.py @@ -555,7 +555,8 @@ class Translations(NullTranslations, gettext.GNUTranslations): filename = gettext.find(domain, dirname, locales) if not filename: return NullTranslations() - return cls(fp=open(filename, 'rb'), domain=domain) + with open(filename, 'rb') as fp: + return cls(fp=fp, domain=domain) def __repr__(self): return '<%s: "%s">' % (type(self).__name__, |