From: Jack Wilsdon Date: Sun, 30 Oct 2016 21:57:12 +0000 (+0000) Subject: Don't skip an erroneous comma when parsing from X-Git-Tag: 2.10~14^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d26947c7f61900ad6c8dc153c9bc8381d413c2f1;p=thirdparty%2Fjinja.git Don't skip an erroneous comma when parsing from Currently we skip an extra comma when "with context" is not provided to the "from" statement. This allows invalid code such as this: {% from "functions.html" import my_function,, %} The primary issue with this is that it is not consistent when providing "with context". The following code throws an error, contrary to the previous example: {% from "functions.html" import my_function,, with context %} It seems that the comma skipping was originally found in 0611e49 and was accidentally put inside the "with context" check in ea847c5. It was then updated to use "skip_if" in fdf9530. There doesn't seem to be any reason for this check existing, as double commas should never be allowed and serve no purpose in the statement. --- diff --git a/jinja2/parser.py b/jinja2/parser.py index 08233642..f8d71bbe 100644 --- a/jinja2/parser.py +++ b/jinja2/parser.py @@ -337,7 +337,6 @@ class Parser(object): self.stream.expect('name') if not hasattr(node, 'with_context'): node.with_context = False - self.stream.skip_if('comma') return node def parse_signature(self, node):