diff options
| author | Chris Jerdonek <chris.jerdonek@gmail.com> | 2021-08-03 11:50:08 -0400 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2021-08-25 13:07:52 +0200 |
| commit | 7ff72b5909894504b2343419630ceb5a4a9cd421 (patch) | |
| tree | b074f30d75d79bc9e3c029ab3e97215062209948 /django/template | |
| parent | 196a99da5d9c4c33a78259a58d38fb114a4d2ee8 (diff) | |
Refs #32919 -- Added assertion for token start in Lexer.create_token().
This adds an assertion in the code path where the method would otherwise
return None, which isn't allowed.
Diffstat (limited to 'django/template')
| -rw-r--r-- | django/template/base.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/django/template/base.py b/django/template/base.py index 5feafb5ef6..b96bb5e3b0 100644 --- a/django/template/base.py +++ b/django/template/base.py @@ -383,9 +383,9 @@ class Lexer: if block_content[:9] in ('verbatim', 'verbatim '): self.verbatim = 'end%s' % block_content return Token(TokenType.BLOCK, block_content, position, lineno) - elif token_start == COMMENT_TAG_START: - content = token_string[2:-2].strip() - return Token(TokenType.COMMENT, content, position, lineno) + assert token_start == COMMENT_TAG_START + content = token_string[2:-2].strip() + return Token(TokenType.COMMENT, content, position, lineno) else: return Token(TokenType.TEXT, token_string, position, lineno) |
