]> git.ipfire.org Git - thirdparty/jinja.git/commit
Fix bug where set would sometimes fail within if 1665/head
authorKevin Brown-Silva <kevin@kevin-brown.com>
Mon, 2 May 2022 21:33:58 +0000 (15:33 -0600)
committerDavid Lord <davidism@gmail.com>
Sat, 21 Dec 2024 17:40:06 +0000 (09:40 -0800)
commit66587ce989e5a478e0bb165371fa2b9d42b7040f
treebeeff96acdc943c8d430e5ed458b14ef924cd298
parentfbc3a696c729d177340cc089531de7e2e5b6f065
Fix bug where set would sometimes fail within if

There was a bug that came as the result of an early optimization done
within ID tracking that caused loading parameters to fail in a very
specific and rare edge case. That edge case only occurred when the
parameter was being set within all 3 standard branches of an if block,
since the optimization would assume that the parameter was never being
referenced and was only ever being set. This would cause the variable to
be set to undefined.

The fix for this was to remove the optimization and still continue to
load in the parameter even if it is set in all 3 branches.
CHANGES.rst
src/jinja2/idtracking.py
tests/test_regression.py