From fc34cb04f4cc406034078fc1f42e5c193c3868b3 Mon Sep 17 00:00:00 2001 From: Alex Morega Date: Fri, 5 Jul 2013 15:57:25 +0200 Subject: make sure we close the file --- babel/support.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'babel/support.py') 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__, -- cgit v1.2.1