]> git.ipfire.org Git - thirdparty/babel.git/commitdiff
make sure we close the file
authorAlex Morega <alex@grep.ro>
Fri, 5 Jul 2013 13:57:25 +0000 (15:57 +0200)
committerAlex Morega <alex@grep.ro>
Fri, 5 Jul 2013 13:58:40 +0000 (15:58 +0200)
babel/support.py

index 80f015cff43d17584cd801bdc9522fbc42cd6791..1f2efc2fa230837b4a98685c5749032c9185f14d 100644 (file)
@@ -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__,