mirror of
https://github.com/servo/servo.git
synced 2025-08-04 05:00:08 +01:00
Utilize Python context managers for opening/closing files
In some of these cases, files were not being closed
This commit is contained in:
parent
7c45ff8e05
commit
2ab43bea5d
5 changed files with 18 additions and 21 deletions
|
@ -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}))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue