Skip to content

Commit

Permalink
#11834 Use reversed instead of creating a copy of slotData for every …
Browse files Browse the repository at this point in the history
…call to _getSlotValue (#11833)
  • Loading branch information
glyph committed Mar 28, 2023
2 parents bacf4c8 + 3039054 commit 525da4a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/twisted/newsfragments/11834.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`twisted.web.template` now avoids unnecessary copying and is faster, particularly for templates with deep nesting.
2 changes: 1 addition & 1 deletion src/twisted/web/_flatten.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def _getSlotValue(
"""
Find the value of the named slot in the given stack of slot data.
"""
for slotFrame in slotData[::-1]:
for slotFrame in reversed(slotData):
if slotFrame is not None and name in slotFrame:
return slotFrame[name]
else:
Expand Down

0 comments on commit 525da4a

Please sign in to comment.