Skip to content
Myr

Fix attribute access in async code. Fixes #1141

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

authored by Armin Ronacher · committed by David Lord · parent bbdafe3 · Browse files · 1 file+4 added−4 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+4 added−4 removed

  • other:+4 added−4 removed

1 file+4 added−4 removed

modified:src/jinja2/compiler.py+4 added-4 removed
1639 unmodified lines
16401641 @optimizeconst1642 def visit_Getattr(self, node, frame):1643 if self.environment.is_async:1644 self.write("await auto_await(")1644 self.write("(await auto_await(")16451646 self.write("environment.getattr(")1647 self.visit(node.node, frame)1648 self.write(", %r)" % node.attr)16491650 if self.environment.is_async:1651 self.write(")")1651 self.write("))")16521653 @optimizeconst1654 def visit_Getitem(self, node, frame):1655 # slices bypass the environment getitem method.
3 unmodified lines
1659 self.visit(node.arg, frame)1660 self.write("]")1661 else:1662 if self.environment.is_async:1663 self.write("await auto_await(")1663 self.write("(await auto_await(")16641665 self.write("environment.getitem(")1666 self.visit(node.node, frame)1667 self.write(", ")1668 self.visit(node.arg, frame)1669 self.write(")")16701671 if self.environment.is_async:1672 self.write(")")1672 self.write("))")16731674 def visit_Slice(self, node, frame):1675 if node.start is not None:1676 self.visit(node.start, frame)
167 unmodified lines