Align compile closer with jinja upstream

pull/82224/head
Matt Martz 11 months ago
parent 0794609d43
commit c8892b39a5
No known key found for this signature in database
GPG Key ID: 40832D88E9FC91D8

@ -592,6 +592,7 @@ class AnsibleEnvironment(NativeEnvironment):
if not C.JINJA2_BYTECODE_CACHE: if not C.JINJA2_BYTECODE_CACHE:
return super().compile(source, name=name, filename=filename, raw=raw, defer_init=defer_init) # type: ignore[call-overload] return super().compile(source, name=name, filename=filename, raw=raw, defer_init=defer_init) # type: ignore[call-overload]
try:
# Environment._parse # Environment._parse
parsed = Parser(self, source, name, filename).parse() parsed = Parser(self, source, name, filename).parse()
@ -610,7 +611,12 @@ class AnsibleEnvironment(NativeEnvironment):
optimized=self.optimized, optimized=self.optimized,
) )
if raw:
return generated
return compile(generated, filename or '<template>', 'exec') return compile(generated, filename or '<template>', 'exec')
except TemplateSyntaxError:
self.handle_exception(source=source)
def from_string( def from_string(
self, self,

Loading…
Cancel
Save