Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build failures with non-NDEBUG, non-Py_DEBUG builds. #61613

Closed
Yhg1s opened this issue Mar 13, 2013 · 6 comments
Closed

Build failures with non-NDEBUG, non-Py_DEBUG builds. #61613

Yhg1s opened this issue Mar 13, 2013 · 6 comments
Labels
build The build process and cross-build

Comments

@Yhg1s
Copy link
Member

Yhg1s commented Mar 13, 2013

BPO 17411
Nosy @Yhg1s, @terryjreedy, @pitrou, @vstinner, @benjaminp, @ezio-melotti
Files
  • assert_fixes.diff: build fixes
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2017-05-22.19:26:14.873>
    created_at = <Date 2013-03-13.18:38:59.232>
    labels = ['build']
    title = 'Build failures with non-NDEBUG, non-Py_DEBUG builds.'
    updated_at = <Date 2017-05-22.19:26:14.872>
    user = 'https://github.com/Yhg1s'

    bugs.python.org fields:

    activity = <Date 2017-05-22.19:26:14.872>
    actor = 'twouters'
    assignee = 'none'
    closed = True
    closed_date = <Date 2017-05-22.19:26:14.873>
    closer = 'twouters'
    components = ['Build']
    creation = <Date 2013-03-13.18:38:59.232>
    creator = 'twouters'
    dependencies = []
    files = ['29400']
    hgrepos = []
    issue_num = 17411
    keywords = ['patch']
    message_count = 6.0
    messages = ['184102', '184264', '184265', '184270', '184271', '184272']
    nosy_count = 6.0
    nosy_names = ['twouters', 'terry.reedy', 'pitrou', 'vstinner', 'benjamin.peterson', 'ezio.melotti']
    pr_nums = []
    priority = 'normal'
    resolution = 'out of date'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue17411'
    versions = ['Python 3.3']

    @Yhg1s
    Copy link
    Member Author

    Yhg1s commented Mar 13, 2013

    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.

    @Yhg1s Yhg1s added the build The build process and cross-build label Mar 13, 2013
    @terryjreedy
    Copy link
    Member

    The patch changes unicodeobject.c and obmalloc.c
    Thomas, is the problem new to 3.3 (and the new unicode implementation)?

    @Yhg1s
    Copy link
    Member Author

    Yhg1s commented Mar 15, 2013

    Yes, I already had the same kinds of failures fixed for 3.2, before; this only affects 3.3 and later.

    @vstinner
    Copy link
    Member

    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.

    @vstinner
    Copy link
    Member

    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\>


    @Yhg1s
    Copy link
    Member Author

    Yhg1s commented Mar 15, 2013

    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.

    @Yhg1s Yhg1s closed this as completed May 22, 2017
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    build The build process and cross-build
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants