interpreter: avoid that add_languages_for modifies its arguments

The list can be reused in the next call to add_languages:

            success = len(langs) == len(args[0])
            success &= self.add_languages(langs, required, MachineChoice.HOST)
            success &= self.add_languages(langs, False, MachineChoice.BUILD)

Fixes: 17eb224aa
Fixes: aee7f375b
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Paolo Bonzini authored and Dylan Baker committed 2026-10-28 06:19:39 -07:00
1 parent 5e0f6e9865
commit 3797fba8c4
1 file changed
+8 -4
+8 -4
View File
@@ -1618,10 +1618,14 @@ class Interpreter(InterpreterBase, HoldableObject):
langs.update(args)
# Some languages are added only as implementation details of other
# languages. When that happens, we don't want to add those languages to
# the project enabled languages, as they are implementation details, not
# something the user explicitly asked for, and we don't want to be
# forced to keep them forever if the implementation changes.
# languages. When that happens, args is modified in place, so make
# a copy.
args = list(args)
# We don't want to add those languages to the project enabled languages,
# as they are implementation details, not something the user explicitly
# asked for, and we don't want to be forced to keep them forever
# if the implementation changes.
internal: T.Set[Language] = set()
if 'vala' in langs and 'c' not in langs: