Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Fix deadlock in LRUCache and improve test coverage #1000
I was adding tests for Undefined and other utils by running coverage and finding which lines did not have test coverage, then I found there is a deadlock bug in the LRUCache's setdefault method.
As documented in the commit: setdefault was acquiring write_lock, then calling getitem and also
from jinja2.utils import LRUCache x = LRUCache(1) x.setdefault(1) # <-- deadlock :(
It's fixed now and we have better test coverage