diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2022-09-02 16:23:18 -0700 |
---|---|---|
committer | Eli Schwartz <eschwartz@archlinux.org> | 2022-11-29 23:26:05 -0500 |
commit | 5794805f8e76dfe940f6c09d080d9068fe1ff98d (patch) | |
tree | b85c458fafca27c878a36db544c2ccaa9a5c4e23 | |
parent | e8727fc8571bc8b9dc23255c267b52478d12e66f (diff) | |
download | meson-5794805f8e76dfe940f6c09d080d9068fe1ff98d.zip meson-5794805f8e76dfe940f6c09d080d9068fe1ff98d.tar.gz meson-5794805f8e76dfe940f6c09d080d9068fe1ff98d.tar.bz2 |
pylint: enable used-before-assignment
The one case of this was a false-positive, but what we were doing
(checking locals()) is not idiomatic. I've replaced the call to
`locals()` with the obvious `var: T.Optional[str] = None` with check
instead.
-rw-r--r-- | .pylintrc | 1 | ||||
-rw-r--r-- | mesonbuild/msetup.py | 4 |
2 files changed, 3 insertions, 2 deletions
@@ -74,7 +74,6 @@ disable= unused-argument, unused-variable, use-implicit-booleaness-not-comparison, - used-before-assignment, useless-return, useless-super-delegation, wrong-import-order, diff --git a/mesonbuild/msetup.py b/mesonbuild/msetup.py index 7c452d4..43594dd 100644 --- a/mesonbuild/msetup.py +++ b/mesonbuild/msetup.py @@ -231,6 +231,8 @@ class MesonApp: except Exception as e: mintro.write_meson_info_file(b, [e]) raise + + cdf: T.Optional[str] = None try: dumpfile = os.path.join(env.get_scratch_dir(), 'build.dat') # We would like to write coredata as late as possible since we use the existence of @@ -281,7 +283,7 @@ class MesonApp: except Exception as e: mintro.write_meson_info_file(b, [e]) - if 'cdf' in locals(): + if cdf is not None: old_cdf = cdf + '.prev' if os.path.exists(old_cdf): os.replace(old_cdf, cdf) |