diff options
author | bors-servo <metajack+bors@gmail.com> | 2015-08-21 09:30:06 -0600 |
---|---|---|
committer | bors-servo <metajack+bors@gmail.com> | 2015-08-21 09:30:06 -0600 |
commit | 3a48e04caffa4ba25854a4190883d1985845a359 (patch) | |
tree | 6b6b7843469d00fd7303ffa2b6251f6657c2edc4 /components/script/dom/bindings/codegen/BindingGen.py | |
parent | 7c45ff8e05a6ebd21f9aa5c360e997a01d48b1fc (diff) | |
parent | 2ab43bea5d508f41790339507ed439d2709c0bfa (diff) | |
download | servo-3a48e04caffa4ba25854a4190883d1985845a359.tar.gz servo-3a48e04caffa4ba25854a4190883d1985845a359.zip |
Auto merge of #7305 - frewsxcv:python-context-managers, r=Ms2ger
Utilize Python context managers for opening/closing files
In some of these cases, files were not being closed
<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7305)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom/bindings/codegen/BindingGen.py')
-rw-r--r-- | components/script/dom/bindings/codegen/BindingGen.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/components/script/dom/bindings/codegen/BindingGen.py b/components/script/dom/bindings/codegen/BindingGen.py index f4d4fcdae2a..810f52db566 100644 --- a/components/script/dom/bindings/codegen/BindingGen.py +++ b/components/script/dom/bindings/codegen/BindingGen.py @@ -39,9 +39,8 @@ def main(): webIDLFile = os.path.normpath(args[2]) # Load the parsing results - f = open('ParserResults.pkl', 'rb') - parserData = cPickle.load(f) - f.close() + with open('ParserResults.pkl', 'rb') as f: + parserData = cPickle.load(f) # Create the configuration data. config = Configuration(configFile, parserData) |