From 68cc26e430ea3ed90865296275a3cc7adfa419f5 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sat, 1 Jan 2022 09:05:03 -0800 Subject: [PATCH 1/2] build: use list for mutable retval rather than tuple We define `retval` as a tuple and then replace the tuple by "appending" items with `+=` but that actually creates a new tuple every time. Because it is intended to be mutable, use a list instead, then return a tuple from the function, as it should be immutable outside the function. --- configure.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configure.py b/configure.py index 0156afdc4c9163..a27407ae29b67a 100755 --- a/configure.py +++ b/configure.py @@ -828,7 +828,7 @@ def pkg_config(pkg): otherwise (None, None, None, None)""" pkg_config = os.environ.get('PKG_CONFIG', 'pkg-config') args = [] # Print pkg-config warnings on first round. - retval = () + retval = [] for flag in ['--libs-only-l', '--cflags-only-I', '--libs-only-L', '--modversion']: args += [flag] @@ -843,9 +843,9 @@ def pkg_config(pkg): except OSError as e: if e.errno != errno.ENOENT: raise e # Unexpected error. return (None, None, None, None) # No pkg-config/pkgconf installed. - retval += (val,) + retval += [val] args = ['--silence-errors'] - return retval + return tuple(retval) def try_check_compiler(cc, lang): From 277dc43511caf1ee87b75a8e7c0659d252e812ad Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sat, 1 Jan 2022 09:23:34 -0800 Subject: [PATCH 2/2] Update configure.py Co-authored-by: Mestery --- configure.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.py b/configure.py index a27407ae29b67a..a1b5c5570b6cb7 100755 --- a/configure.py +++ b/configure.py @@ -843,7 +843,7 @@ def pkg_config(pkg): except OSError as e: if e.errno != errno.ENOENT: raise e # Unexpected error. return (None, None, None, None) # No pkg-config/pkgconf installed. - retval += [val] + retval.append(val) args = ['--silence-errors'] return tuple(retval)