Skip to content
Myr

fix default for `Environment.overlay(enable_async)` (#2061)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by David Lord · committed by GitHub · parents 767b236, e45bc74 · Browse files · 3 files+14 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+14 added−2 removed

  • tests:+8 added−0 removed
  • other:+6 added−2 removed

3 files+14 added−2 removed

modified:src/jinja2/environment.py+5 added-2 removed
404 unmodified lines
405 loader: t.Optional["BaseLoader"] = missing,406 cache_size: int = missing,407 auto_reload: bool = missing,408 bytecode_cache: t.Optional["BytecodeCache"] = missing,409 enable_async: bool = False,409 enable_async: bool = missing,410 ) -> "Environment":411 """Create a new overlay environment that shares all the data with the412 current environment except for cache and the overridden attributes.413 Extensions cannot be removed for an overlayed environment. An overlayed
4 unmodified lines
418 up completely. Not all attributes are truly linked, some are just419 copied over so modifications on the original environment may not shine420 through.421422 .. versionchanged:: 3.1.5423 ``enable_async`` is applied correctly.424425 .. versionchanged:: 3.1.2423 Added the ``newline_sequence``,, ``keep_trailing_newline``,426 Added the ``newline_sequence``, ``keep_trailing_newline``,427 and ``enable_async`` parameters to match ``__init__``.428 """429 args = dict(locals())430 del args["self"], args["cache_size"], args["extensions"], args["enable_async"]
1242 unmodified lines
modified:tests/test_api.py+8 added
423 unmodified lines
424425 env = CustomEnvironment()426 tmpl = env.from_string("{{ foo }}")427 assert tmpl.render() == "resolve-foo"428429430def test_overlay_enable_async(env):431 assert not env.is_async432 assert not env.overlay().is_async433 env_async = env.overlay(enable_async=True)434 assert env_async.is_async435 assert not env_async.overlay(enable_async=False).is_async
modified:CHANGES.rst+1 added
32 unmodified lines
33- Fix dunder protocol (`copy`/`pickle`/etc) interaction with ``Undefined``34 objects. :issue:`2025`35- Fix `copy`/`pickle` support for the internal ``missing`` object.36 :issue:`2027`37- ``Environment.overlay(enable_async)`` is applied correctly. :pr:`2061`383940Version 3.1.441-------------
994 unmodified lines