Lisandro wrote:
> Then my patch will fix test cases like the above as follow:
>
> cdef void foo():
>    int var1, var2=0
>    var1 = var2
>
> foo()
>
> Note that I'm just initializing 'var2' and using 'foo'. Do you see any
> drawback about that?

Well, there are drawbacks, but I'm getting less worried about how serious
they are.

But I'll just explain the drawbacks for the sake of the explanation. We
just had a severe bug espace our attention for months (and which you
found) because

"""
cdef object unused
"""

was not a testcase. Now

"""
cdef object unusded = 3
"""

would not have helped -- in fact this is an entirely different testcase!
The latter one makes "entry.used" be set differently and would trigger
entirely different paths through the code in Cython.

Now, local variables are a different matter. In fact, I don't know how
they work myself. I just know that if they are initialized, the testcase
tests something else than what it originally tested -- some if-tests
within Cython (concerning entry.used and so on) may start taking another
route, and perhaps some code blocks are then left untested.

But this can be countered by creating a new testcase specifically targeted
for covering what you now remove, so I'm getting more friendly towards
your patch.

Dag Sverre

_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to