Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix all the loop bugs #804

Closed
robertwb opened this issue Mar 18, 2009 · 5 comments
Closed

Fix all the loop bugs #804

robertwb opened this issue Mar 18, 2009 · 5 comments

Comments

@robertwb
Copy link
Contributor

robertwb commented Mar 18, 2009

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 http://trac.cython.org/ticket/208 and http://trac.cython.org/ticket/196 without a performance penalty.

Migrated from http://trac.cython.org/ticket/243

@robertwb
Copy link
Contributor Author

@dagss changed milestone from 0.10.1 to 0.11.1
commented

@robertwb
Copy link
Contributor Author

@robertwb
Copy link
Contributor Author

@robertwb changed resolution to fixed
status from new to closed
commented

@robertwb
Copy link
Contributor Author

@robertwb changed component from Code Generation to Python Semantics
commented

@robertwb
Copy link
Contributor Author

@robertwb changed summary from

another for in range loop bug

to

Fix all the loop bugs
commented

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant