From fa974634348b322c05b5f49b2058ae3de7ef5663 Mon Sep 17 00:00:00 2001 From: Hemmo Nieminen Date: Mon, 21 Aug 2017 22:42:07 +0300 Subject: [PATCH] Fix a stack trace caused by environment variables in test setups. An example trace: [snip] > File "/usr/lib/python3.6/concurrent/futures/thread.py", line 55, in run > result = self.fn(*self.args, **self.kwargs) > File "/home/trhd/Projects/meson/mesonbuild/mtest.py", line 221, in run_single_test > child_env.update(self.options.global_env.get_env(child_env)) > AttributeError: 'dict' object has no attribute 'get_env' --- mesonbuild/interpreter.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index 788abef0f..c449cc6d6 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -2283,7 +2283,7 @@ class Interpreter(InterpreterBase): else: if not isinstance(envlist, list): envlist = [envlist] - env = {} + env = EnvironmentVariablesHolder() for e in envlist: if '=' not in e: raise InterpreterException('Env var definition must be of type key=val.') @@ -2292,7 +2292,8 @@ class Interpreter(InterpreterBase): val = val.strip() if ' ' in k: raise InterpreterException('Env var key must not have spaces in it.') - env[k] = val + env.add_var(env.held_object.set, [k, val], kwargs) + env = env.held_object return env def add_test(self, node, args, kwargs, is_base_test):