[issue16342] setup.py not compiling with NDEBUG in non-debug builds

Brett Cannon report at bugs.python.org
Sun Oct 28 03:32:19 CET 2012


New submission from Brett Cannon:

Discovered on OS X 10.8 with clang 3.1, I'm having build failures for _json, _md5, _sha1, _sha256, _sha3, and _sha512 because _PyUnicode_CheckConsistency() is only defined when defined(Py_DEBUG) && !defined(Py_LIMITED_API) even though it is only used in assert() calls (like the one below). If you read the comment in Include/Python.h where assert.h is included it explicitly says that:

/* CAUTION:  Build setups should ensure that NDEBUG is defined on the
 * compiler command line when building Python in release mode; else
 * assert() calls won't be removed.
 */

Based on the output below that is not currently happening in setup.py. Not sure if that is a failure of setup.py or distutils of not specifying the flag.



building '_json' extension
/Users/bcannon/Developer/bin/clang -Wno-unused-result -g -O0 -Wall -Wstrict-prototypes -Wno-unused-value -Wno-empty-body -Qunused-arguments -Wno-unused-value -Wno-empty-body -Qunused-arguments -I./Include -I. -I/Users/bcannon/Developer/include -I/Users/bcannon/Developer/Cellar/readline/6.2.2/include -I/Users/bcannon/Developer/repo/cpython/py3.3/Include -I/Users/bcannon/Developer/repo/cpython/py3.3 -c /Users/bcannon/Developer/repo/cpython/py3.3/Modules/_json.c -o build/temp.macosx-10.8-x86_64-3.3/Users/bcannon/Developer/repo/cpython/py3.3/Modules/_json.o
/Users/bcannon/Developer/repo/cpython/py3.3/Modules/_json.c:249:12: warning: implicit declaration of function
      '_PyUnicode_CheckConsistency' is invalid in C99 [-Wimplicit-function-declaration]
    assert(_PyUnicode_CheckConsistency(rval, 1));
           ^
/usr/include/assert.h:93:25: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
                        ^
1 warning generated.
/Users/bcannon/Developer/bin/clang -bundle -undefined dynamic_lookup -L /Users/bcannon/Developer/lib -L/Users/bcannon/Developer/Cellar/readline/6.2.2/lib -L /Users/bcannon/Developer/lib -L/Users/bcannon/Developer/Cellar/readline/6.2.2/lib -L /Users/bcannon/Developer/lib -L/Users/bcannon/Developer/Cellar/readline/6.2.2/lib -Wno-unused-value -Wno-empty-body -Qunused-arguments -I /Users/bcannon/Developer/include -I/Users/bcannon/Developer/Cellar/readline/6.2.2/include build/temp.macosx-10.8-x86_64-3.3/Users/bcannon/Developer/repo/cpython/py3.3/Modules/_json.o -L/Users/bcannon/Developer/lib -L/Users/bcannon/Developer/Cellar/readline/6.2.2/lib -o build/lib.macosx-10.8-x86_64-3.3/_json.so
*** WARNING: renaming "_json" since importing it failed: dlopen(build/lib.macosx-10.8-x86_64-3.3/_json.so, 2): Symbol not found: __PyUnicode_CheckConsistency
  Referenced from: build/lib.macosx-10.8-x86_64-3.3/_json.so
  Expected in: flat namespace
 in build/lib.macosx-10.8-x86_64-3.3/_json.so

----------
components: Build
keywords: 3.3regression
messages: 173992
nosy: brett.cannon, eric.araujo
priority: normal
severity: normal
stage: needs patch
status: open
title: setup.py not compiling with NDEBUG in non-debug builds
type: compile error
versions: Python 3.3, Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16342>
_______________________________________


More information about the Python-bugs-list mailing list