]> git.ipfire.org Git - thirdparty/babel.git/commitdiff
Close files earlier
authorVille Skyttä <ville.skytta@iki.fi>
Tue, 26 Jul 2016 20:30:06 +0000 (23:30 +0300)
committerVille Skyttä <ville.skytta@iki.fi>
Tue, 26 Jul 2016 23:23:13 +0000 (02:23 +0300)
babel/localedata.py
babel/messages/frontend.py

index 9c6f9f2b955a0efd7767e3c985a23265aed2e941..87981fe2a574e2c52b7ad687be4aebc657f76588 100644 (file)
@@ -112,9 +112,9 @@ def load(name, merge_inherited=True):
                     merge(data, pickle.load(fileobj))
                 else:
                     data = pickle.load(fileobj)
-                _cache[name] = data
             finally:
                 fileobj.close()
+            _cache[name] = data
         return data
     finally:
         _cache_lock.release()
index 89a7b54ab913b7d4fd616e64de67fb938d8afe1c..a4e9c2e577105dd6af7d8e7d999e0482ac068f68 100644 (file)
@@ -474,10 +474,10 @@ class extract_messages(Command):
             fileobj = open(self.mapping_file, 'U')
             try:
                 method_map, options_map = parse_mapping(fileobj)
-                for path in self.input_paths:
-                    mappings.append((path, method_map, options_map))
             finally:
                 fileobj.close()
+            for path in self.input_paths:
+                mappings.append((path, method_map, options_map))
 
         elif getattr(self.distribution, 'message_extractors', None):
             message_extractors = self.distribution.message_extractors