-
-
Notifications
You must be signed in to change notification settings - Fork 3k
[mypyc] declare Py_ssize_t i
outside of loop initialization
#10091
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
[mypyc] declare Py_ssize_t i
outside of loop initialization
#10091
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for finding this and fixing it!
I'd say there should be some more systematic way to fix this but this definitely helps. Can you confirm the error reported in your issue getting solved with this PR?(I cannot reproduce on my machine).
Hi @TH3CHARLie thanks for your question. Yes for me with latest master, any program will not compile when running
However, with this patch mypyc compatible programs do compile with After a bit more experimentation, I found that I get this compiler error with gcc version 4.8.5 and I don't get this compiler error on latest master with gcc version 7.5.0 and clang version 3.4. So this was all likely due to me having an old version of gcc on my system. One way to solve this generally (if we want to be able to use C code such as The following is a little noisy, but it shows what happens when I try to compile
(^ error)
(^ success)
(^ success) |
That's similar to the rough idea in my mind to solve this more systematically. Another potential(but more aggressive) alternative is to reject lower-version C compilers and document this as desired behavior. I am merging this now. Feel free to comment below if anyone has different opinions on this |
Description
Fixes mypyc/mypyc#800
I believe this is the only instance of a variable declaration inside a for-loop initialization. Removing this may help with consistent compilation across different C compiler configurations. See linked issue for more details.