From: Alex Morega Date: Fri, 5 Jul 2013 13:57:25 +0000 (+0200) Subject: make sure we close the file X-Git-Tag: 1.0~116^2~1^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fc34cb04f4cc406034078fc1f42e5c193c3868b3;p=thirdparty%2Fbabel.git make sure we close the file --- diff --git a/babel/support.py b/babel/support.py index 80f015cf..1f2efc2f 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__,