Issue 38376: ./configure --with-assertions generates a broken build (original) (raw)

Following

./configure --prefix=$HOME/.local --with-assertions

and then running make leads to an error:

$ make gcc -pthread -c -Wno-unused-result -Wsign-compare -g -fwrapv -O3 -Wall -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -I./Include/internal -I. -I./Include -DPy_BUILD_CORE -o Objects/codeobject.o Objects/codeobject.c gcc -pthread -c -Wno-unused-result -Wsign-compare -g -fwrapv -O3 -Wall -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -I./Include/internal -I. -I./Include -DPy_BUILD_CORE -o Objects/complexobject.o Objects/complexobject.c gcc -pthread -c -Wno-unused-result -Wsign-compare -g -fwrapv -O3 -Wall -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -I./Include/internal -I. -I./Include -DPy_BUILD_CORE -o Objects/descrobject.o Objects/descrobject.c In file included from ./Include/object.h:746:0, from ./Include/pytime.h:6, from ./Include/Python.h:85, from Objects/descrobject.c:3: ./Include/object.h:111:38: error: expected ‘)’ before ‘’ token #define _PyObject_CAST(op) ((PyObject)(op)) ^ ./Include/cpython/object.h:337:36: note: in definition of macro ‘PyType_HasFeature’ #define PyType_HasFeature(t,f) (((t)->tp_flags & (f)) != 0) ^ ./Include/unicodeobject.h:115:18: note: in expansion of macro ‘PyType_FastSubclass’ PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_UNICODE_SUBCLASS) ^ ./Include/object.h:122:34: note: in expansion of macro ‘_PyObject_CAST’ #define Py_TYPE(ob) (_PyObject_CAST(ob)->ob_type) ^ ./Include/unicodeobject.h:115:38: note: in expansion of macro ‘Py_TYPE’ PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_UNICODE_SUBCLASS) ^ ./Include/unicodeobject.h:1042:56: note: in expansion of macro ‘PyUnicode_Check’ #define _PyUnicode_CheckConsistency(op, check_content) PyUnicode_Check(op) ^ ./Include/internal/pycore_object.h:14:17: note: in expansion of macro ‘_PyUnicode_CheckConsistency’ PyAPI_FUNC(int) _PyUnicode_CheckConsistency(PyObject op, int check_content); ^ ./Include/object.h:111:40: error: expected ‘)’ before ‘(’ token #define _PyObject_CAST(op) ((PyObject)(op)) ^ ./Include/cpython/object.h:337:36: note: in definition of macro ‘PyType_HasFeature’ #define PyType_HasFeature(t,f) (((t)->tp_flags & (f)) != 0) ^ ./Include/unicodeobject.h:115:18: note: in expansion of macro ‘PyType_FastSubclass’ PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_UNICODE_SUBCLASS) ^ ./Include/object.h:122:34: note: in expansion of macro ‘_PyObject_CAST’ #define Py_TYPE(ob) (_PyObject_CAST(ob)->ob_type) ^ ./Include/unicodeobject.h:115:38: note: in expansion of macro ‘Py_TYPE’ PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_UNICODE_SUBCLASS) ^ ./Include/unicodeobject.h:1042:56: note: in expansion of macro ‘PyUnicode_Check’ #define _PyUnicode_CheckConsistency(op, check_content) PyUnicode_Check(op) ^ ./Include/internal/pycore_object.h:14:17: note: in expansion of macro ‘_PyUnicode_CheckConsistency’ PyAPI_FUNC(int) _PyUnicode_CheckConsistency(PyObject *op, int check_content); ^ ./Include/object.h:122:52: error: expected ‘)’ before ‘->’ token #define Py_TYPE(ob) (_PyObject_CAST(ob)->ob_type) ^ ./Include/cpython/object.h:337:36: note: in definition of macro ‘PyType_HasFeature’ #define PyType_HasFeature(t,f) (((t)->tp_flags & (f)) != 0) ^ ./Include/unicodeobject.h:115:18: note: in expansion of macro ‘PyType_FastSubclass’ PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_UNICODE_SUBCLASS) ^ ./Include/unicodeobject.h:115:38: note: in expansion of macro ‘Py_TYPE’ PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_UNICODE_SUBCLASS) ^ ./Include/unicodeobject.h:1042:56: note: in expansion of macro ‘PyUnicode_Check’ #define _PyUnicode_CheckConsistency(op, check_content) PyUnicode_Check(op) ^ ./Include/internal/pycore_object.h:14:17: note: in expansion of macro ‘_PyUnicode_CheckConsistency’ PyAPI_FUNC(int) _PyUnicode_CheckConsistency(PyObject *op, int check_content); ^ ./Include/cpython/object.h:337:38: error: expected ‘)’ before ‘->’ token #define PyType_HasFeature(t,f) (((t)->tp_flags & (f)) != 0) ^ ./Include/object.h:351:35: note: in expansion of macro ‘PyType_HasFeature’ #define PyType_FastSubclass(t,f) PyType_HasFeature(t,f) ^ ./Include/unicodeobject.h:115:18: note: in expansion of macro ‘PyType_FastSubclass’ PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_UNICODE_SUBCLASS) ^ ./Include/unicodeobject.h:1042:56: note: in expansion of macro ‘PyUnicode_Check’ #define _PyUnicode_CheckConsistency(op, check_content) PyUnicode_Check(op) ^ ./Include/internal/pycore_object.h:14:17: note: in expansion of macro ‘_PyUnicode_CheckConsistency’ PyAPI_FUNC(int) _PyUnicode_CheckConsistency(PyObject *op, int check_content); ^ ./Include/cpython/object.h:337:56: error: expected ‘)’ before ‘!=’ token #define PyType_HasFeature(t,f) (((t)->tp_flags & (f)) != 0) ^ ./Include/object.h:351:35: note: in expansion of macro ‘PyType_HasFeature’ #define PyType_FastSubclass(t,f) PyType_HasFeature(t,f) ^ ./Include/unicodeobject.h:115:18: note: in expansion of macro ‘PyType_FastSubclass’ PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_UNICODE_SUBCLASS) ^ ./Include/unicodeobject.h:1042:56: note: in expansion of macro ‘PyUnicode_Check’ #define _PyUnicode_CheckConsistency(op, check_content) PyUnicode_Check(op) ^ ./Include/internal/pycore_object.h:14:17: note: in expansion of macro ‘_PyUnicode_CheckConsistency’ PyAPI_FUNC(int) _PyUnicode_CheckConsistency(PyObject *op, int check_content); ^ Makefile:1711: recipe for target 'Objects/descrobject.o' failed make: *** [Objects/descrobject.o] Error 1

BTW, this happens even if Py_DEBUG=true is defined. System where the failure occurred: Ubuntu 16.04, 64-bit.

After pushing some fixes to 3.8 and master branches, I tested the following commands in 3.7, 3.8 and master branches:

make distclean ./configure --prefix=$HOME/.local --with-assertions make ./python -m test -j0 test_bytes test_gc test_capi

These commands now work in the 3 branches. I close the issue.

Thanks Vinay Sajip for the bug report! Thanks T. Wouters for previous fixes.

@T. Wouters: I took the liberty of closing your PR 16594 in favor of my PR 16623. I may backport PR 16612 enhancements to 3.8 later, but not jus before a 3.8.0 final release to no stress our release manager ;-)