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

Spurious warning "unused result" in for-in-range loop #3310

Open
bartek-siudeja opened this issue Jan 12, 2020 · 1 comment
Open

Spurious warning "unused result" in for-in-range loop #3310

bartek-siudeja opened this issue Jan 12, 2020 · 1 comment

Comments

@bartek-siudeja
Copy link

@bartek-siudeja bartek-siudeja commented Jan 12, 2020

Cython 0.29.10 and 0.29.14:

# cython: warn.unused=True, warn.unused_result=True

def unused_result_loop():
    cdef Py_ssize_t i, j=0
    for i in range(10): # ok
        j += i
    for i in range(1, 10): # unused_result
        j += i
    return j

Is there a way to rewrite this loop to avoid warnings, without deprecated for-from loop?

@scoder

This comment has been minimized.

Copy link
Contributor

@scoder scoder commented Jan 18, 2020

Definitely a bug. Probably easy to fix. PR welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.