Opened 8 years ago

Closed 8 years ago

Last modified 5 years ago

#9756 closed (fixed)

Recent changes to for tag (adding empty clause) leave context stack imbalanced when iterable is empty

Reported by: Sean Legassick Owned by: nobody
Component: Template system Version: 1.0
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

When the iterable passed to the for tag is empty, the ForNode.render method returns without calling context.pop (which it should as context.push is called previously in the method). The attached patch fixes this and adds code to the template tag regression tests that checks that context stack is left balanced after every tag test.

Attachments (1)

for-tag-leaves-imbalanced-context-stack.patch (1.9 KB) - added by Sean Legassick 8 years ago.

Download all attachments as: .zip

Change History (6)

Changed 8 years ago by Sean Legassick

comment:1 Changed 8 years ago by (none)

milestone: post-1.0

Milestone post-1.0 deleted

comment:2 Changed 8 years ago by Jacob

milestone: 1.1
Triage Stage: UnreviewedAccepted

comment:3 Changed 8 years ago by Bas Peschier

Ah, explains why an nested forloop with an empty iterable causes the .first-attribute of his parent loop to be true incorrectly. Just bumped into this one, nice to see it fixed! :-)

comment:4 Changed 8 years ago by Jacob

Resolution: fixed
Status: newclosed

Fixed in r10439.

comment:5 Changed 5 years ago by Jacob

milestone: 1.1

Milestone 1.1 deleted

Note: See TracTickets for help on using tickets.
Back to Top