diff options
| author | Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> | 2021-10-06 22:55:23 +0200 |
|---|---|---|
| committer | Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> | 2021-10-06 23:02:28 +0200 |
| commit | 8add3c171446e65a22e4db961ca58273c492eb92 (patch) | |
| tree | 62b8da09a6f464e7c47d2427ab2c50ec7e0c07c8 /numpy | |
| parent | dfc3761d6dedadb677aca907a0d098406a3241e7 (diff) | |
| download | numpy-8add3c171446e65a22e4db961ca58273c492eb92.tar.gz | |
MAINT: Fix LGTM.com warning: File is not always closed
File may not be closed if an exception is raised.
Diffstat (limited to 'numpy')
| -rw-r--r-- | numpy/distutils/mingw32ccompiler.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/numpy/distutils/mingw32ccompiler.py b/numpy/distutils/mingw32ccompiler.py index 4681d403b..541055899 100644 --- a/numpy/distutils/mingw32ccompiler.py +++ b/numpy/distutils/mingw32ccompiler.py @@ -651,7 +651,6 @@ def generate_manifest(config): mi = int((msver - ma) * 10) # Write the manifest file manxml = msvc_manifest_xml(ma, mi) - man = open(manifest_name(config), "w") - config.temp_files.append(manifest_name(config)) - man.write(manxml) - man.close() + with open(manifest_name(config), "w") as man: + config.temp_files.append(manifest_name(config)) + man.write(manxml) |
