зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1229241
- Allow moz.build special variables to be set, as long as the value is not modified. r=gps
This will allow a new kind of special variable where it is possible to do FOO += ['bar'] All the current special variables are either strings (for which __setitem__ would be called with a different string object), or a read-only dict (which doesn't allow modifications).
This commit is contained in:
Родитель
e5b1bb9e4e
Коммит
1c6231c29c
|
@ -219,6 +219,8 @@ class MozbuildSandbox(Sandbox):
|
|||
return Sandbox.__contains__(self, key)
|
||||
|
||||
def __setitem__(self, key, value):
|
||||
if key in self.special_variables and value is self[key]:
|
||||
return
|
||||
if key in self.special_variables or key in self.functions or key in self.subcontext_types:
|
||||
raise KeyError('Cannot set "%s" because it is a reserved keyword'
|
||||
% key)
|
||||
|
|
Загрузка…
Ссылка в новой задаче