From ca6683095d2521f0f166a4ec51583c424f1bcd84 Mon Sep 17 00:00:00 2001 From: Daniel Mensinger Date: Thu, 8 Jul 2021 20:56:31 +0200 Subject: [PATCH] fix: Fix recursive _unholder permissive kwarg (fixes #8977) --- mesonbuild/interpreterbase/_unholder.py | 4 ++-- test cases/common/242 set and get variable/meson.build | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/mesonbuild/interpreterbase/_unholder.py b/mesonbuild/interpreterbase/_unholder.py index 7e95232ee..10c7cfc8f 100644 --- a/mesonbuild/interpreterbase/_unholder.py +++ b/mesonbuild/interpreterbase/_unholder.py @@ -22,9 +22,9 @@ def _unholder(obj: T.Union[TYPE_var, InterpreterObject], *, permissive: bool = F if isinstance(obj, (int, bool, str)): return obj elif isinstance(obj, list): - return [_unholder(x) for x in obj] + return [_unholder(x, permissive=permissive) for x in obj] elif isinstance(obj, dict): - return {k: _unholder(v) for k, v in obj.items()} + return {k: _unholder(v, permissive=permissive) for k, v in obj.items()} elif isinstance(obj, ObjectHolder): assert isinstance(obj.held_object, HoldableObject) return obj.held_object diff --git a/test cases/common/242 set and get variable/meson.build b/test cases/common/242 set and get variable/meson.build index 7c8dcf7bd..4ecdb3529 100644 --- a/test cases/common/242 set and get variable/meson.build +++ b/test cases/common/242 set and get variable/meson.build @@ -41,6 +41,8 @@ assert(get_variable('var9') == 'test2.txt') assert(not is_disabler(get_variable('var0'))) assert(not is_disabler(get_variable('var0', var8))) assert(not is_disabler(get_variable('----', var8))) +assert(not is_disabler(get_variable('----', [var8]))) +assert(not is_disabler(get_variable('----', {'asd': var8}))) # test dict get dict = {'a': var2}