Fixed a bug in the parser that made ``{{ foo[1, 2] }}`` impossible.
--HG--
branch : trunk
diff --git a/CHANGES b/CHANGES
index bf7853e..edbdb0e 100644
--- a/CHANGES
+++ b/CHANGES
@@ -12,6 +12,7 @@
required parentheses (`not (foo in bar)`) which was odd.
- Fixed a bug that caused syntax errors when defining macros or using the
`{% call %}` tag inside loops.
+- Fixed a bug in the parser that made ``{{ foo[1, 2] }}`` impossible.
Version 2.1.1
-------------
diff --git a/jinja2/parser.py b/jinja2/parser.py
index b6e23df..d3eb8c4 100644
--- a/jinja2/parser.py
+++ b/jinja2/parser.py
@@ -602,7 +602,7 @@
if len(args) == 1:
arg = args[0]
else:
- arg = nodes.Tuple(args, self.lineno, self.filename)
+ arg = nodes.Tuple(args, 'load', lineno=token.lineno)
return nodes.Getitem(node, arg, 'load', lineno=token.lineno)
self.fail('expected subscript expression', self.lineno)
diff --git a/tests/test_syntax.py b/tests/test_syntax.py
index 2a8e46f..5e9e804 100644
--- a/tests/test_syntax.py
+++ b/tests/test_syntax.py
@@ -195,3 +195,11 @@
bar = xrange(100)
tmpl = env.from_string('''{{ not 42 in bar }}''')
assert tmpl.render(bar=bar) == unicode(not 42 in bar)
+
+
+def test_implicit_subscribed_tuple(env):
+ class Foo(object):
+ def __getitem__(self, x):
+ return x
+ t = env.from_string('{{ foo[1, 2] }}')
+ assert t.render(foo=Foo()) == u'(1, 2)'