@@ -393,6 +393,8 @@ def overlay(
393
393
line_comment_prefix : t .Optional [str ] = missing ,
394
394
trim_blocks : bool = missing ,
395
395
lstrip_blocks : bool = missing ,
396
+ newline_sequence : "te.Literal['\\ n', '\\ r\\ n', '\\ r']" = missing ,
397
+ keep_trailing_newline : bool = missing ,
396
398
extensions : t .Sequence [t .Union [str , t .Type ["Extension" ]]] = missing ,
397
399
optimized : bool = missing ,
398
400
undefined : t .Type [Undefined ] = missing ,
@@ -402,6 +404,7 @@ def overlay(
402
404
cache_size : int = missing ,
403
405
auto_reload : bool = missing ,
404
406
bytecode_cache : t .Optional ["BytecodeCache" ] = missing ,
407
+ enable_async : bool = False ,
405
408
) -> "Environment" :
406
409
"""Create a new overlay environment that shares all the data with the
407
410
current environment except for cache and the overridden attributes.
@@ -413,9 +416,13 @@ def overlay(
413
416
up completely. Not all attributes are truly linked, some are just
414
417
copied over so modifications on the original environment may not shine
415
418
through.
419
+
420
+ .. versionchanged:: 3.1.2
421
+ Added the ``newline_sequence``,, ``keep_trailing_newline``,
422
+ and ``enable_async`` parameters to match ``__init__``.
416
423
"""
417
424
args = dict (locals ())
418
- del args ["self" ], args ["cache_size" ], args ["extensions" ]
425
+ del args ["self" ], args ["cache_size" ], args ["extensions" ], args [ "enable_async" ]
419
426
420
427
rv = object .__new__ (self .__class__ )
421
428
rv .__dict__ .update (self .__dict__ )
@@ -437,6 +444,9 @@ def overlay(
437
444
if extensions is not missing :
438
445
rv .extensions .update (load_extensions (rv , extensions ))
439
446
447
+ if enable_async is not missing :
448
+ rv .is_async = enable_async
449
+
440
450
return _environment_config_check (rv )
441
451
442
452
@property
0 commit comments