Skip to content

Jinja2-2.9 and Python3 generate <generator> tag #645

@tk0miya

Description

@tk0miya

With 2.9, 2.9.1 and 2.9.2, Jinja2 generates <generator> tag for macro having blocks.

Example code:

import sys
import jinja2
from jinja2 import Template

template = """
{%- macro hello() %}
  Hello, {% block name %}jinja2{% endblock %}!
{%- endmacro %}
{{ hello() }}
"""

Result:

Python vesion: 3.5.2 (default, Oct 11 2016, 17:23:55)
[GCC 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.31)]
Jinja2 vesion: 2.9.2

<generator object macro at 0x10ffe2468>

But this works fine on python2.7.

Python vesion: 2.7.13 (default, Dec 20 2016, 13:27:09)
[GCC 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.31)]
Jinja2 vesion: 2.9.2


  Hello, jinja2!

Note: result of 2.8 and py27, py35.

Python vesion: 2.7.13 (default, Dec 20 2016, 13:27:09)
[GCC 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.31)]
Jinja2 vesion: 2.8.1


  Hello, jinja2!
Python vesion: 3.5.2 (default, Oct 11 2016, 17:23:55)
[GCC 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.31)]
Jinja2 vesion: 2.8.1


  Hello, jinja2!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions