This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: ./configure --with-assertions generates a broken build
Type: behavior Stage: resolved
Components: Build Versions: Python 3.9, Python 3.8
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: twouters, vinay.sajip, vstinner
Priority: normal Keywords: patch

Created on 2019-10-05 12:43 by vinay.sajip, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 16594 closed twouters, 2019-10-05 15:15
PR 16612 merged vstinner, 2019-10-07 10:14
PR 16623 merged vstinner, 2019-10-07 16:24
Messages (10)
msg354006 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2019-10-05 12:43
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.
msg354007 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2019-10-05 12:47
BTW it also seems to fail when just Py_DEBUG is specified (no --with-assertions).
msg354011 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2019-10-05 14:06
Adding Thomas and Victor based on git blame on some of the source lines concerned.
msg354014 - (view) Author: Thomas Wouters (twouters) * (Python committer) Date: 2019-10-05 15:16
The problem is _PyUnicode_CheckConsistency switched from being only defined when Py_DEBUG is set, to being defined unconditionally. That was a good change, but it made the API-compatibility hack of #defining _PyUnicode_CheckConsistency in Include/unicodeobject.h do the wrong thing. PR #16594.
msg354070 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-10-07 10:15
My intent in bpo-36389 was to also provide _PyObject_CheckConsistency() in release mode to help debugging GC crash, especially in visit_decref(). I wrote PR 16612 to fix my implementation.
msg354118 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-10-07 16:42
New changeset 6876257eaabdb30f27ebcbd7d2557278ce2e5705 by Victor Stinner in branch 'master':
bpo-36389: _PyObject_CheckConsistency() available in release mode (GH-16612)
https://github.com/python/cpython/commit/6876257eaabdb30f27ebcbd7d2557278ce2e5705
msg354129 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-10-07 19:12
New changeset 435b2eeb7bc5b8ec264e900b38bcb3d76552d777 by Victor Stinner in branch '3.8':
bpo-38376: Fix _PyUnicode_CheckConsistency() definition (GH-16623)
https://github.com/python/cpython/commit/435b2eeb7bc5b8ec264e900b38bcb3d76552d777
msg354139 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-10-07 20:34
I pushed one more fix in https://bugs.python.org/issue36389#msg354138
msg354140 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-10-07 20:39
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 ;-)
msg354680 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-10-15 01:06
New changeset f82ce5b1b12873b65927149a016be6a7c65e979d by Victor Stinner in branch '3.8':
[3.8] bpo-36389: Backport debug enhancements from master (GH-16796)
https://github.com/python/cpython/commit/f82ce5b1b12873b65927149a016be6a7c65e979d
History
Date User Action Args
2022-04-11 14:59:21adminsetgithub: 82557
2019-10-15 01:06:21vstinnersetmessages: + msg354680
2019-10-07 20:39:08vstinnersetstatus: open -> closed
versions: + Python 3.8
messages: + msg354140

resolution: fixed
stage: patch review -> resolved
2019-10-07 20:34:50vstinnersetmessages: + msg354139
2019-10-07 19:12:19vstinnersetmessages: + msg354129
2019-10-07 16:42:03vstinnersetmessages: + msg354118
2019-10-07 16:24:26vstinnersetpull_requests: + pull_request16210
2019-10-07 10:15:22vstinnersetmessages: + msg354070
2019-10-07 10:14:01vstinnersetstage: patch review
pull_requests: + pull_request16201
2019-10-05 15:16:13twouterssetmessages: + msg354014
stage: patch review -> (no value)
2019-10-05 15:15:24twouterssetkeywords: + patch
stage: patch review
pull_requests: + pull_request16183
2019-10-05 14:06:35vinay.sajipsetnosy: + twouters, vstinner
messages: + msg354011
2019-10-05 12:47:02vinay.sajipsetmessages: + msg354007
2019-10-05 12:43:51vinay.sajipcreate