fix: Fix recursive _unholder permissive kwarg (fixes #8977)

pull/8688/merge
Daniel Mensinger 3 years ago committed by Jussi Pakkanen
parent c8c7c56897
commit ca6683095d
  1. 4
      mesonbuild/interpreterbase/_unholder.py
  2. 2
      test cases/common/242 set and get variable/meson.build

@ -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

@ -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}

Loading…
Cancel
Save