Bug 1257516 - Allow to assign Exceptions in the global scope. r?ted
But do not advertise it too much.
--- a/python/mozbuild/mozbuild/configure/__init__.py
+++ b/python/mozbuild/mozbuild/configure/__init__.py
@@ -227,17 +227,18 @@ class ConfigureSandbox(dict):
return super(ConfigureSandbox, self).__getitem__(key)
def __setitem__(self, key, value):
if (key in self.BUILTINS or key == '__builtins__' or
hasattr(self, '%s_impl' % key)):
raise KeyError('Cannot reassign builtins')
if (not isinstance(value, DummyFunction) and
- value not in self._templates):
+ value not in self._templates and
+ not issubclass(value, Exception)):
raise KeyError('Cannot assign `%s` because it is neither a '
'@depends nor a @template' % key)
return super(ConfigureSandbox, self).__setitem__(key, value)
def _resolve(self, arg, need_help_dependency=True):
if isinstance(arg, DummyFunction):
assert arg in self._depends