``{% trans "title" %}``. :issue:`1430`
- Update valid identifier characters from Python 3.6 to 3.7.
:pr:`1571`
+- Filters and tests decorated with ``@async_variant`` are pickleable.
+ :pr:`1612`
Version 3.0.3
import inspect
import typing as t
+from functools import WRAPPER_ASSIGNMENTS
from functools import wraps
from .utils import _PassArg
def is_async(args: t.Any) -> bool:
return t.cast(bool, args[0].environment.is_async)
- @wraps(normal_func)
+ # Take the doc and annotations from the sync function, but the
+ # name from the async function. Pallets-Sphinx-Themes
+ # build_function_directive expects __wrapped__ to point to the
+ # sync function.
+ async_func_attrs = ("__module__", "__name__", "__qualname__")
+ normal_func_attrs = tuple(set(WRAPPER_ASSIGNMENTS).difference(async_func_attrs))
+
+ @wraps(normal_func, assigned=normal_func_attrs)
+ @wraps(async_func, assigned=async_func_attrs, updated=())
def wrapper(*args, **kwargs): # type: ignore
b = is_async(args)
--- /dev/null
+import pickle
+
+
+def test_environment(env):
+ env = pickle.loads(pickle.dumps(env))
+ assert env.from_string("x={{ x }}").render(x=42) == "x=42"