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: Build failures with non-NDEBUG, non-Py_DEBUG builds.
Type: Stage: resolved
Components: Build Versions: Python 3.3
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: benjamin.peterson, ezio.melotti, pitrou, terry.reedy, twouters, vstinner
Priority: normal Keywords: patch

Created on 2013-03-13 18:38 by twouters, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
assert_fixes.diff twouters, 2013-03-13 18:38 build fixes review
Messages (6)
msg184102 - (view) Author: Thomas Wouters (twouters) * (Python committer) Date: 2013-03-13 18:38
Similar to http://bugs.python.org/issue14509, Python 3.3 conflates Py_DEBUG and non-NDEBUG builds, creating build failures when building with 'CFLAGS=-UNDEBUG ./configure --without-pydebug'. (assert statements are only compiled out when NDEBUG is set, not when Py_DEBUG is unset.) This patch fixes the two root causes.
msg184264 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2013-03-15 21:46
The patch changes unicodeobject.c and obmalloc.c
Thomas, is the problem new to 3.3 (and the new unicode implementation)?
msg184265 - (view) Author: Thomas Wouters (twouters) * (Python committer) Date: 2013-03-15 21:51
Yes, I already had the same kinds of failures fixed for 3.2, before; this only affects 3.3 and later.
msg184270 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2013-03-15 22:28
I added _PyUnicode_CheckConsistency() to Python 3.3 to check the implementation of the PEP 393, this function should not be called in release mode, that's just it is not defined in release mode.
msg184271 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2013-03-15 22:31
> that's just it is not defined in release mode.

that's *why*

2013/3/15 STINNER Victor <report@bugs.python.org>:
>
> STINNER Victor added the comment:
>
> I added _PyUnicode_CheckConsistency() to Python 3.3 to check the implementation of the PEP 393, this function should not be called in release mode, that's just it is not defined in release mode.
>
> ----------
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <http://bugs.python.org/issue17411>
> _______________________________________
msg184272 - (view) Author: Thomas Wouters (twouters) * (Python committer) Date: 2013-03-15 22:34
Unfortunately there is no "release mode". There's Py_DEBUG mode, and the absence of Py_DEBUG. And there's NDEBUG, and the absence of NDEBUG, which controls the assert macro. Py_DEBUG unsets NDEBUG, but *not* setting Py_DEBUG doesn't *set* NDEBUG (nor should it.)

In the Google build environment, where we occasionally embed Python and also build extensions that use Python and Python itself in slightly different ways, we have build modes that don't set Py_DEBUG but don't set NDEBUG -- so we keep the asserts, but don't set Py_DEBUG (which would change the ABI.) I suggest that this is a valid expectation :) If something is used in assert statements (and _PyUnicode_CheckConsistency is, quite a lot) it needs to be defined whenever NDEBUG is not defined, not just when Py_DEBUG is defined. The patch makes it a macro that calls PyUnicode_Check() in that case, because that's what unicodeobject.c itself does.

In the case of obmalloc, the asserts are calling functions that are only defined when PYMALLOC_DEBUG is set, so it seems obvious that that's the guard that should surround their use.
History
Date User Action Args
2022-04-11 14:57:42adminsetgithub: 61613
2017-05-22 19:26:14twouterssetstatus: open -> closed
stage: resolved
2017-05-22 19:26:07twouterssetresolution: out of date
2013-03-15 22:34:35twouterssetmessages: + msg184272
2013-03-15 22:31:04vstinnersetmessages: + msg184271
2013-03-15 22:28:09vstinnersetmessages: + msg184270
2013-03-15 21:51:11twouterssetmessages: + msg184265
2013-03-15 21:46:23terry.reedysetnosy: + terry.reedy, pitrou, ezio.melotti, benjamin.peterson, vstinner
messages: + msg184264
2013-03-13 18:38:59twouterscreate