[New-bugs-announce] [issue14509] Build failures in non-pydebug builds without NDEBUG.

Thomas Wouters report at bugs.python.org
Thu Apr 5 15:42:51 CEST 2012

New submission from Thomas Wouters <thomas at python.org>:

The hash randomization change conflates 'pydebug' builds (which define the 'Py_DEBUG' preprocessor symbol) and asserts (which use 'NDEBUG' instead.) While Py_DEBUG automatically unsets NDEBUG, the inverse is not true (and should not be true.)

In random.c (and Include/object.h), _Py_HashSecret_Initialized is defined as static or global depending on the value of Py_DEBUG. But in (at least) Objects/stringobject.c and Objects/unicodeobject.c, unguarded asserts are used that check the value of _Py_HashSecret_Initialized. This causes builds that define neither NDEBUG nor Py_DEBUG to fail. Either the guard used around the declaration and definition should be '#ifndef NDEBUG' instead of '#ifdef Py_DEBUG', or there should be a Py_DEBUG guard around the two assert statements.

(I would submit a patch but my development environment died during a nasty power outage yesterday.)

components: Interpreter Core
messages: 157586
nosy: benjamin.peterson, twouters
priority: release blocker
severity: normal
status: open
title: Build failures in non-pydebug builds without NDEBUG.
type: compile error
versions: Python 2.7

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list