[Cython] [Fwd: Re: Beginner-friendly tickets]
Prajwal Suhas P
psp.reachable at gmail.com
Fri Mar 20 18:47:03 CET 2009
On Fri, Mar 20, 2009 at 10:30 PM, Stefan Behnel <stefan_ml at behnel.de> wrote:
>
> Prajwal Suhas P wrote:
> > I have restructured and removed the redundant code. Can someone review
> this
> > patch.
>
> I cleaned it up a bit in the way I described in my last e-mail. Now it
> looks ok to me. One problem I noticed is that I get a gcc warning about
> this code:
>
> --------------------------------
> def f():
> cdef int i
> for i in range(g()):
> print i
> print i
>
> warning: '__pyx_v_i' may be used uninitialized in this function
> --------------------------------
>
> which is true, because "i" may not have been initialised at the end,
> depending on the return value of g(). Since this is exactly what Python
> will tell you also, I'm fine with leaving it as it is, though:
>
> --------------------------------
> >>> for i in range(0): print i
> ...
> >>> i
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> NameError: name 'i' is not defined
> --------------------------------
>
> So I fixed the test case also by initialising i.
>
> Is this ok with you?
>
> Stefan
> _______________________________________________
> Cython-dev mailing list
> Cython-dev at codespeak.net
> http://codespeak.net/mailman/listinfo/cython-dev
>
Perfect. No issues. I initialized "i" to zero and it worked as expected.
--
Regards,
Prajwal S.
"There is little difference in people,but this little difference makes a big
difference.The little difference is attitude,the big difference is whether
its positive or negative. "
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://codespeak.net/pipermail/cython-dev/attachments/20090320/9cefb0da/attachment.htm
More information about the Cython-dev
mailing list