From 2ab43bea5d508f41790339507ed439d2709c0bfa Mon Sep 17 00:00:00 2001 From: Corey Farwell Date: Fri, 21 Aug 2015 11:15:17 -0400 Subject: Utilize Python context managers for opening/closing files In some of these cases, files were not being closed --- .../script/dom/bindings/codegen/GenerateCSS2PropertiesWebIDL.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'components/script/dom/bindings/codegen/GenerateCSS2PropertiesWebIDL.py') diff --git a/components/script/dom/bindings/codegen/GenerateCSS2PropertiesWebIDL.py b/components/script/dom/bindings/codegen/GenerateCSS2PropertiesWebIDL.py index 55303f6c55b..37cde2702c5 100644 --- a/components/script/dom/bindings/codegen/GenerateCSS2PropertiesWebIDL.py +++ b/components/script/dom/bindings/codegen/GenerateCSS2PropertiesWebIDL.py @@ -18,9 +18,8 @@ for [prop, pref] in propList: props += " [%s] attribute DOMString %s;\n" % (", ".join(extendedAttrs), prop) -idlFile = open(sys.argv[1], "r") -idlTemplate = idlFile.read() -idlFile.close() +with open(sys.argv[1], "r") as idlFile: + idlTemplate = idlFile.read() print ("/* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT */\n\n" + string.Template(idlTemplate).substitute({"props": props})) -- cgit v1.2.3