-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
[3.5] bpo-36478: Use C89 for loops in backported pickle patch #12622
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
[3.5] bpo-36478: Use C89 for loops in backported pickle patch #12622
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.
LGTM, assuming that it was a deliberate choice to not include detection of regressions of this sort as part of the CI tests, which I assume @vstinner would know.
If that was an oversight, now might be a good time to try to remedy the situation (would also make it easier to tell if this PR actually solves the bug, too).
fwiw, this patch was necessary to build for deadsnakes: deadsnakes/python3.5@fe8602d |
I'm not sure of what you means by "regression". Using GCC 8.3.1 (on Fedora 29), I get 65 compiler warnings but no warnings on _pickle.c, with "./configure -C --with-pydebug CFLAGS=-O0 && make". https://bugs.python.org/issue36478 is just a compiler warning. I don't know why it is seen as an error. For example, GCC uses ISO C99 by default. |
I tried gcc -std=c89, the compiler fails early on a different file:
This comment was added 4 years ago:
I'm not sure which kind of problem we are trying to solve here. I know that on Windows, "error: 'for' loop initial declarations are only allowed in C99 mode" might be an error, but at this point, nobody tried to build the latest Python 3.5 on Windows and the compilation goes fine on Linux with default GCC flags. There issue looks to be specific to compiler flags used by https://github.com/deadsnakes |
Sorry, for some reason I misread the original issue and thought that you filed it, which is why I figured it was something that was detected by a buildbot. According to PEP 7, for Python 3.5, the code should be C89 and it seems like it's one step above a pure-style refactoring if |
The compiler targetted here is pretty old (but then again, so is python3.5): gcc 4.8.x From the man page: https://gcc.gnu.org/onlinedocs/gcc-4.8.5/gcc/C-Dialect-Options.html#C-Dialect-Options
In gnu89: root@5b98b67e14ee:/# gcc --version
gcc (Ubuntu 4.8.4-2ubuntu1~14.04.4) 4.8.4
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
root@5b98b67e14ee:/# gcc t.c
t.c: In function 'main':
t.c:4:5: error: 'for' loop initial declarations are only allowed in C99 mode
for (int i = 0; i < 5; i += 1) {
^
t.c:4:5: note: use option -std=c99 or -std=gnu99 to compile your code
root@5b98b67e14ee:/# cat t.c
#include <stdio.h>
int main(void) {
for (int i = 0; i < 5; i += 1) {
printf("%d\n", i);
}
} |
needed for debian:stretch builds with default gcc |
Misc/NEWS.d/next/Build/2019-03-29-14-29-06.bpo-36478.hzyneF.rst
Outdated
Show resolved
Hide resolved
… use C89 for loops in backported pickle patch
7a93296
to
7df8f06
Compare
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.
LGTM.
I tested manually: compilation fails with gcc -std=gnu89 without the change, but the compilation completes with the change.
@larryhastings: Would you mind to merge this PR to compilation support of old GCC versions? |
@larryhastings bump on this! |
@larryhastings: Please replace |
Thanks for the 3.5 love! |
https://bugs.python.org/issue36478