Skip to content
Browse files

Fixed #17303 -- Ensured the list of template loaders is fully loaded …

…before it is cached. Thanks andrey DOT gtx AT gmail DOT com for the report and patch, and Anssi Kääriäinen for the review.

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent ca984aa commit fa226cd740f1349383d5e8399dc8a5255b70f07a @aaugustin aaugustin committed
Showing with 5 additions and 1 deletion.
  1. +5 −1 django/template/loaders/
6 django/template/loaders/
@@ -19,8 +19,12 @@ def __init__(self, loaders):
def loaders(self):
# Resolve loaders on demand to avoid circular imports
if not self._cached_loaders:
+ # Set self._cached_loaders atomically. Otherwise, another thread
+ # could see an incomplete list. See #17303.
+ cached_loaders = []
for loader in self._loaders:
- self._cached_loaders.append(find_template_loader(loader))
+ cached_loaders.append(find_template_loader(loader))
+ self._cached_loaders = cached_loaders
return self._cached_loaders
def find_template(self, name, dirs=None):

0 comments on commit fa226cd

Please sign in to comment.
Something went wrong with that request. Please try again.