Ticket #243 (closed defect: fixed)

Opened 5 years ago

Last modified 5 years ago

Fix all the loop bugs

Reported by: robertwb Owned by: robertwb
Priority: critical Milestone: 0.11.1
Component: Python Semantics Keywords:
Cc:

Description

def test_loop(N):
    cdef int i
    for i in range(N):
        print i
        i = 5
    return i

Gives

>>> loop.test_loop(3)
0
5
>>> loop.test_loop(10)
0
6
6
...

where the later is an infinite loop. What I think we *should* do is have a shadow loop variable in the C for loop, and assign it to the target loop variable at the top of the loop.

This would also independently solve #208 and #196 without a performance penalty.

Change History

Changed 5 years ago by dagss

  • milestone changed from 0.10.1 to 0.11.1

Changed 5 years ago by robertwb

  • status changed from new to closed
  • resolution set to fixed

Changed 5 years ago by robertwb

  • component changed from Code Generation to Python Semantics

Changed 5 years ago by robertwb

  • summary changed from another for in range loop bug to Fix all the loop bugs
Note: See TracTickets for help on using tickets.