Skip to content

Commit 80a3766

Browse files
Trotttargos
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 <[email protected]> Reviewed-By: Tobias Nießen <[email protected]>
1 parent 0768302 commit 80a3766

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

configure.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -828,7 +828,7 @@ def pkg_config(pkg):
828828
otherwise (None, None, None, None)"""
829829
pkg_config = os.environ.get('PKG_CONFIG', 'pkg-config')
830830
args = [] # Print pkg-config warnings on first round.
831-
retval = ()
831+
retval = []
832832
for flag in ['--libs-only-l', '--cflags-only-I',
833833
'--libs-only-L', '--modversion']:
834834
args += [flag]
@@ -843,9 +843,9 @@ def pkg_config(pkg):
843843
except OSError as e:
844844
if e.errno != errno.ENOENT: raise e # Unexpected error.
845845
return (None, None, None, None) # No pkg-config/pkgconf installed.
846-
retval += (val,)
846+
retval.append(val)
847847
args = ['--silence-errors']
848-
return retval
848+
return tuple(retval)
849849

850850

851851
def try_check_compiler(cc, lang):

0 commit comments

Comments
 (0)