Opened 8 years ago

Closed 7 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: seanl 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:


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 seanl 8 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 Changed 8 years ago by anonymous

  • milestone post-1.0 deleted

Milestone post-1.0 deleted

comment:2 Changed 7 years ago by jacob

  • milestone set to 1.1
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:3 Changed 7 years ago by bpeschier

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 7 years ago by jacob

  • Resolution set to fixed
  • Status changed from new to closed

Fixed in r10439.

comment:5 Changed 5 years ago by jacob

  • milestone 1.1 deleted

Milestone 1.1 deleted

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