From 23123e60138a162556cdbb54c3c347f7553342ab Mon Sep 17 00:00:00 2001 From: Manuel Francisco Naranjo Date: Mon, 21 Jul 2014 20:26:29 -0300 Subject: Adding a unit-test for pull-request #150 A unit-test for pull-request #150 has been create to make sure no regressions are introduced as part of the bugfix. It is kind of salvage it just removes BUILDERS from the dict and check everything can keep going --- src/engine/SCons/EnvironmentTests.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/engine/SCons/EnvironmentTests.py b/src/engine/SCons/EnvironmentTests.py index 5235342..b9ef3f2 100644 --- a/src/engine/SCons/EnvironmentTests.py +++ b/src/engine/SCons/EnvironmentTests.py @@ -1892,6 +1892,11 @@ def generate(env): env = env.Clone(KEY_THAT_I_WANT=6, tools=[my_tool]) assert env['KEY_THAT_I_WANT'] == real_value[0], env['KEY_THAT_I_WANT'] + # test for pull request #150 + env = self.TestEnvironment() + env._dict.pop('BUILDERS') + assert env.has_key('BUILDERS') is False + env2 = env.Clone() def test_Copy(self): """Test copying using the old env.Copy() method""" -- cgit v0.12 From c83fbe751e3a3d0f8e44eb97f9584f518b3a2b66 Mon Sep 17 00:00:00 2001 From: Manuel Francisco Naranjo Date: Mon, 21 Jul 2014 20:26:40 -0300 Subject: Prevent non defined named non defined exception In a project I'm running I hitted a case where BUILDERS is not part of _dict which leads to variable builders not defined, making the core of SCons crash --- src/engine/SCons/Environment.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/engine/SCons/Environment.py b/src/engine/SCons/Environment.py index d178f49..7789855 100644 --- a/src/engine/SCons/Environment.py +++ b/src/engine/SCons/Environment.py @@ -1378,10 +1378,8 @@ class Base(SubstitutionEnvironment): (like a function). There are no references to any mutable objects in the original Environment. """ - try: - builders = self._dict['BUILDERS'] - except KeyError: - pass + + builders = self._dict.get('BUILDERS', {}) clone = copy.copy(self) # BUILDERS is not safe to do a simple copy -- cgit v0.12