wrap filters/conditionals in a try-except block

allows accessing undefined fields without exception or locals().get(…)
but hides mistakes/typos/etc by evaluating to False without feedback

performance loss compared to the previous version without try-except
is negligible (~20ns for me)
This commit is contained in:
Mike Fährmann
2024-07-11 01:16:06 +02:00
parent c83c812a1e
commit f7383a56f8
4 changed files with 42 additions and 8 deletions

View File

@@ -105,6 +105,11 @@ def main():
output.ANSI = True
# filter environment
filterenv = config.get((), "filters-environment", True)
if not filterenv:
util.compile_expression = util.compile_expression_raw
# format string separator
separator = config.get((), "format-separator")
if separator: