﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
28001	Investigate/update comment about context popping in ForNode.render()	Baptiste Mispelon	kapil garg	"The code for `ForNode.render()` [1] has a bit of code with a comment that reads:
{{{
# The loop variables were pushed on to the context so pop them
# off again. This is necessary because the tag lets the length
# of loopvars differ to the length of each set of items and we
# don't want to leave any vars from the previous loop on the
# context.
}}}

I believe this sentence is incorrect, because `{% for ... %}` raises an error when there's a mismatch between the variable count and the number of items retrieve during iteration (this behavior is tested explicitly [2]).

I did a bit of digging and this comment was correct when it was added (16269c4d0a5d2e61c7555fec438440abee9be9f5) but the error-raising feature was added after that.

When removing the `context.pop()` just after that comment, the test suite still passes which indicates that either the code is unnecessary, or it's untested.

[1] https://github.com/django/django/blob/70197241017575b60973b038c8f68dcb18526110/django/template/defaulttags.py#L213-L219
[2] https://github.com/django/django/blob/70197241017575b60973b038c8f68dcb18526110/tests/template_tests/syntax_tests/test_for.py#L157"	Cleanup/optimization	closed	Template system	1.11	Normal	fixed			Accepted	0	0	1	0	0	0
