File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
fluent.runtime/fluent/runtime Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change 4040class CurrentEnvironment (object ):
4141 # The parts of ResolverEnvironment that we want to mutate (and restore)
4242 # temporarily for some parts of a call chain.
43+
44+ # The values of attributes here must not be mutated, they must only be
45+ # swapped out for different objects using `modified` (see below).
46+
47+ # For Messages, VariableReference nodes are interpreted as external args,
48+ # but for Terms they are the values explicitly passed using CallExpression
49+ # syntax. So we have to be able to change 'args' for this purpose.
4350 args = attr .ib ()
51+ # This controls whether we need to report an error if a VariableReference
52+ # refers to an arg that is not present in the args dict.
4453 error_for_missing_arg = attr .ib (default = True )
4554
4655
@@ -58,8 +67,8 @@ def modified(self, **replacements):
5867 Context manager that modifies the 'current' attribute of the
5968 environment, restoring the old data at the end.
6069 """
61- # CurrentEnvironment only has immutable args at the moment , so the
62- # shallow copy returned by attr.evolve is fine.
70+ # CurrentEnvironment only has args that we never mutate , so the shallow
71+ # copy returned by attr.evolve is fine (at least for now) .
6372 old_current = self .current
6473 self .current = attr .evolve (old_current , ** replacements )
6574 yield self
You can’t perform that action at this time.
0 commit comments