Skip to content

Commit c65ac72

Browse files
Trottdanielleadams
authored andcommitted
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. PR-URL: #41372 Reviewed-By: Christian Clauss <cclauss@me.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
1 parent 003dd37 commit c65ac72

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

configure.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,7 @@ def pkg_config(pkg):
833833
otherwise (None, None, None, None)"""
834834
pkg_config = os.environ.get('PKG_CONFIG', 'pkg-config')
835835
args = [] # Print pkg-config warnings on first round.
836-
retval = ()
836+
retval = []
837837
for flag in ['--libs-only-l', '--cflags-only-I',
838838
'--libs-only-L', '--modversion']:
839839
args += [flag]
@@ -848,9 +848,9 @@ def pkg_config(pkg):
848848
except OSError as e:
849849
if e.errno != errno.ENOENT: raise e # Unexpected error.
850850
return (None, None, None, None) # No pkg-config/pkgconf installed.
851-
retval += (val,)
851+
retval.append(val)
852852
args = ['--silence-errors']
853-
return retval
853+
return tuple(retval)
854854

855855

856856
def try_check_compiler(cc, lang):

0 commit comments

Comments
 (0)