I was looking through the parser and noticed that default arguments for macro/call parameters aren't attached to the parameter they were defined with. This can lead to unexpected behaviour:
>>> import jinja2
>>> jinja2.Template("{% macro a(b, c=1, d) %}b={{b}},c={{c}},d={{d}}{% endmacro %} {{ a() }}").render()
u' b=,c=,d=1'
Here you can see that the default was applied to parameter d instead of c. There are two fixes for this:
- Tie the defaults to the parameter they were defined from
- Throw a synxtax error like python does:
SyntaxError: non-default argument follows default argument
I was looking through the parser and noticed that default arguments for macro/call parameters aren't attached to the parameter they were defined with. This can lead to unexpected behaviour:
Here you can see that the default was applied to parameter
dinstead ofc. There are two fixes for this:SyntaxError: non-default argument follows default argument