Antoine Pitrou <[EMAIL PROTECTED]> added the comment:

Hmm, ok. I was using `make EXTRA_CFLAGS="-DPy_DEBUG"`, but it wouldn't
undefine NDEBUG so the assert() macro wouldn't be enabled.
By using `make EXTRA_CFLAGS="-DPy_DEBUG -UNDEBUG"` instead it's fine.

But that makes test_c_api in setobject.c bogus, because it relies on the
execution of assert() statements to modify the refcount of certain
objects - which doesn't happen when assert() is optimized out. The only
reason it doesn't crash in non-debug mode is that the deallocated
objects are still intact in memory, and Py_REFCNT simply drops their
refcount field to -1 without bothering.

It also means the following statement in Misc/SpecialBuilds.txt is
misleading:

« Py_DEBUG implies LLTRACE, Py_REF_DEBUG, Py_TRACE_REFS, and
PYMALLOC_DEBUG (if WITH_PYMALLOC is enabled).  In addition, C
assert()s are enabled (via the C way: by not defining NDEBUG) »

I haven't looked at the distutils problem yet.

----------
assignee:  -> georg.brandl
components: +Documentation -Tests
nosy: +georg.brandl
priority:  -> high
title: some tests fail in debug mode (test_distutils, test_set) -> some tests 
fail with Py_DEBUG (test_distutils, test_set)
type: crash -> behavior
versions: +Python 2.6

_______________________________________
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue3356>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to