diff options
author | Elliott Sales de Andrade <quantum.analyst@gmail.com> | 2016-08-24 19:29:11 -0400 |
---|---|---|
committer | Elliott Sales de Andrade <quantum.analyst@gmail.com> | 2016-08-27 18:29:55 -0400 |
commit | 4c71695e41a50dda3199d26ed7aedbaaf3150768 (patch) | |
tree | 8bd499a2a113c3da5c1dee8ed29f4b3c69d27dd7 /mesonbuild/mesonmain.py | |
parent | 7830cb61c39fbaf57933ac403dcdf5007667d87d (diff) | |
download | meson-4c71695e41a50dda3199d26ed7aedbaaf3150768.zip meson-4c71695e41a50dda3199d26ed7aedbaaf3150768.tar.gz meson-4c71695e41a50dda3199d26ed7aedbaaf3150768.tar.bz2 |
Use context manager for file I/O.
There are a few cases where a context manager cannot be used, such as
the logger.
Diffstat (limited to 'mesonbuild/mesonmain.py')
-rw-r--r-- | mesonbuild/mesonmain.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/mesonbuild/mesonmain.py b/mesonbuild/mesonmain.py index 65d979b..617704a 100644 --- a/mesonbuild/mesonmain.py +++ b/mesonbuild/mesonmain.py @@ -169,7 +169,8 @@ itself as required.''' g.generate(intr) g.run_postconf_scripts() dumpfile = os.path.join(env.get_scratch_dir(), 'build.dat') - pickle.dump(b, open(dumpfile, 'wb')) + with open(dumpfile, 'wb') as f: + pickle.dump(b, f) # Write this last since we use the existence of this file to check if # we generated the build file successfully, so we don't want an error # that pops up during generation, post-conf scripts, etc to cause us to |