Smaller fixes to stuff that broke on 3.x
diff --git a/jinja2/asyncfilters.py b/jinja2/asyncfilters.py
index d12afaf..5c1f46d 100644
--- a/jinja2/asyncfilters.py
+++ b/jinja2/asyncfilters.py
@@ -47,6 +47,8 @@
if wrap_evalctx:
wrapper.evalcontextfilter = True
+ wrapper.asyncfiltervariant = True
+
return wrapper
diff --git a/jinja2/nodes.py b/jinja2/nodes.py
index 76f7814..4d62ccc 100644
--- a/jinja2/nodes.py
+++ b/jinja2/nodes.py
@@ -592,6 +592,13 @@
filter_ = self.environment.filters.get(self.name)
if filter_ is None or getattr(filter_, 'contextfilter', False):
raise Impossible()
+
+ # We cannot constant handle async filters, so we need to make sure
+ # to not go down this path.
+ if eval_ctx.environment.is_async and \
+ getattr(filter_, 'asyncfiltervariant', False):
+ raise Impossible()
+
obj = self.node.as_const(eval_ctx)
args = [obj] + [x.as_const(eval_ctx) for x in self.args]
if getattr(filter_, 'evalcontextfilter', False):
diff --git a/tests/test_filters.py b/tests/test_filters.py
index 1a8a164..2e85a9a 100644
--- a/tests/test_filters.py
+++ b/tests/test_filters.py
@@ -581,7 +581,7 @@
env = Environment(autoescape=True)
t = env.from_string('{{ x|tojson }}')
assert t.render(x={'foo': 'bar'}) == '{"foo": "bar"}'
- assert t.render(x='"bar\'') == '"\"bar\u0027"'
+ assert t.render(x='"bar\'') == r'"\"bar\u0027"'
def my_dumps(value, **options):
assert options == {'foo': 'bar'}