Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign up[3.5] bpo-36478: Use C89 for loops in backported pickle patch #12622
Conversation
This comment has been minimized.
This comment has been minimized.
|
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). |
This comment has been minimized.
This comment has been minimized.
|
fwiw, this patch was necessary to build for deadsnakes: deadsnakes/python3.5@fe8602d |
This comment has been minimized.
This comment has been minimized.
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. |
This comment has been minimized.
This comment has been minimized.
|
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 |
This comment has been minimized.
This comment has been minimized.
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 |
This comment has been minimized.
This comment has been minimized.
|
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);
}
} |
This comment has been minimized.
This comment has been minimized.
|
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
|
LGTM. I tested manually: compilation fails with gcc -std=gnu89 without the change, but the compilation completes with the change. |
This comment has been minimized.
This comment has been minimized.
|
@larryhastings: Would you mind to merge this PR to compilation support of old GCC versions? |
This comment has been minimized.
This comment has been minimized.
|
@larryhastings bump on this! |
43a0ae9
into
python:3.5
This comment has been minimized.
This comment has been minimized.
bedevere-bot
commented
Jul 13, 2019
|
@larryhastings: Please replace |
This comment has been minimized.
This comment has been minimized.
|
Thanks for the 3.5 love! |
asottile commentedMar 29, 2019
•
edited by bedevere-bot
https://bugs.python.org/issue36478