New submission from Gabriel Somlo: C programs using PyMem_MALLOC in pymem.h generate a warning when -Wint-in-bool-context is enabled (typically through -Wall). In places where -Werror is enabled (such as RPM build), this causes the build to fail with an error that looks like:
... In file included from /usr/include/python2.7/Python.h:78:0, from netnsmodule.c:16: netnsmodule.c: In function 'netns_nsexecvp': /usr/include/python2.7/pymem.h:97:30: error: '*' in boolean context, suggest '&&' instead [-Werror=int-in-bool-context] ( (type *) PyMem_MALLOC((n) * sizeof(type)) ) ) ^ /usr/include/python2.7/pymem.h:75:15: note: in definition of macro 'PyMem_MALLOC' : malloc((n) ? (n) : 1)) ^ netnsmodule.c:61:10: note: in expansion of macro 'PyMem_NEW' argv = PyMem_NEW(char *, argc + 1); ^~~~~~~~~ cc1: all warnings being treated as errors error: command 'gcc' failed with exit status 1 ... I'm attaching a patch that fixes the issue, please consider applying! Thanks, --Gabriel ---------- files: Python-2.7.13-pymem-gcc7.patch keywords: patch messages: 298973 nosy: Gabriel Somlo priority: normal severity: normal status: open title: gcc7 throws warning when pymem.h development header is used versions: Python 2.7 Added file: http://bugs.python.org/file47035/Python-2.7.13-pymem-gcc7.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue31013> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com