Skip to content
Myr

Kill const folding for call which does not work anyways

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Armin Ronacher · committed by Armin Ronacher · parent fa2d955 · Browse files · 1 file+0 added−32 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+0 added−32 removed

  • other:+0 added−32 removed

1 file+0 added−32 removed

modified:jinja2/nodes.py-32 removed
629 unmodified lines
630 arguments.631 """632 fields = ('node', 'args', 'kwargs', 'dyn_args', 'dyn_kwargs')633634 def as_const(self, eval_ctx=None):635 eval_ctx = get_eval_context(self, eval_ctx)636 if eval_ctx.volatile or eval_ctx.environment.sandboxed:637 raise Impossible()638 obj = self.node.as_const(eval_ctx)634640 # don't evaluate context functions641 args = [x.as_const(eval_ctx) for x in self.args]642 if isinstance(obj, _context_function_types):643 if getattr(obj, 'contextfunction', False):644 raise Impossible()645 elif getattr(obj, 'evalcontextfunction', False):646 args.insert(0, eval_ctx)647 elif getattr(obj, 'environmentfunction', False):648 args.insert(0, self.environment)649650 kwargs = dict(x.as_const(eval_ctx) for x in self.kwargs)651 if self.dyn_args is not None:652 try:653 args.extend(self.dyn_args.as_const(eval_ctx))654 except Exception:655 raise Impossible()656 if self.dyn_kwargs is not None:657 try:658 kwargs.update(self.dyn_kwargs.as_const(eval_ctx))659 except Exception:660 raise Impossible()661 try:662 return obj(*args, **kwargs)663 except Exception:664 raise Impossible()665666635class Getitem(Expr):636 """Get an attribute or item from an expression and prefer the item."""637 fields = ('node', 'arg', 'ctx')638
278 unmodified lines