From 6242c22a2f062f1b55f8a612b75063966937bc5d Mon Sep 17 00:00:00 2001 From: Chris Jerdonek Date: Sun, 8 Aug 2021 01:59:41 -0400 Subject: [PATCH] Refs #33002 -- Optimized Lexer.tokenize() by skipping computing lineno when not needed. --- django/template/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/django/template/base.py b/django/template/base.py index c01f36a34e..a3182ea704 100644 --- a/django/template/base.py +++ b/django/template/base.py @@ -357,8 +357,8 @@ class Lexer: for bit in tag_re.split(self.template_string): if bit: result.append(self.create_token(bit, None, lineno, in_tag)) + lineno += bit.count('\n') in_tag = not in_tag - lineno += bit.count('\n') return result def create_token(self, token_string, position, lineno, in_tag):