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: some tests fail with 'make EXTRA_CFLAGS="-DPy_DEBUG"' (test_distutils, test_set)
Type: crash Stage:
Components: Build, Documentation, Tests Versions: Python 3.1, Python 2.6
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: georg.brandl Nosy List: benjamin.peterson, georg.brandl, pitrou, rhettinger
Priority: low Keywords:

Created on 2008-07-14 21:15 by pitrou, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 6522 closed sblondon, 2018-04-18 18:45
Messages (7)
msg69661 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2008-07-14 21:15
With the latest py3k, some tests fail when run in debug mode:

- test_distutils fails with the following message:

FAILED (errors=1)
Traceback (most recent call last):
  File "Lib/test/test_distutils.py", line 17, in <module>
test_main()
  File "Lib/test/test_distutils.py", line 13, in test_main
test.support.run_unittest(distutils.tests.test_suite())
  File "/home/antoine/py3k/pristine/Lib/test/support.py", line 717, in
run_unittest
_run_suite(suite)
  File "/home/antoine/py3k/pristine/Lib/test/support.py", line 700, in
_run_suite
raise TestFailed(err)
test.support.TestFailed: Traceback (most recent call last):
  File
"/home/antoine/py3k/pristine/Lib/distutils/tests/test_build_ext.py",
line 48, in test_build_ext
    import xx
AttributeError: mro

- test_set crashes with the following message:

./python Lib/test/test_set.py 
test_add (__main__.TestSet) ... ok
test_and (__main__.TestSet) ... ok
test_badcmp (__main__.TestSet) ... ok
test_c_api (__main__.TestSet) ... Fatal Python error:
Objects/setobject.c:2429 object at 0xb797ce04 has negative ref count -1
Abandon
msg69663 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2008-07-14 21:45
I'll look at the test_set failure if no one else gets to it first.
msg69666 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2008-07-14 22:54
Neither of these fail for me on MacOS.
msg69667 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2008-07-14 23:17
On another machine, with another distro (Debian stable) and another gcc
version (4.1.2 instead of 4.3.1), I even get a segmentation fault on
test_distutils:

$ ./python Lib/test/test_set.py 
test_add (__main__.TestSet) ... ok
test_and (__main__.TestSet) ... ok
test_badcmp (__main__.TestSet) ... ok
test_c_api (__main__.TestSet) ... Fatal Python error:
Objects/setobject.c:2429 object at 0xb761ce04 has negative ref count -1
Abandon

$ ./python Lib/test/test_distutils.py 
test_build_ext (distutils.tests.test_build_ext.BuildExtTestCase) ...
Erreur de segmentation
msg69674 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2008-07-15 06:01
I can't reproduce the error using Windows.
msg70299 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2008-07-26 12:37
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.
msg70300 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2008-07-26 12:39
> Py_REFCNT simply drops their refcount field to -1 without bothering.

I meant Py_DECREF.
History
Date User Action Args
2022-04-11 14:56:36adminsetgithub: 47606
2018-04-18 18:45:49sblondonsetpull_requests: + pull_request6216
2010-10-21 17:11:27pitrousetstatus: open -> closed
resolution: wont fix
2009-05-16 20:35:19ajaksu2setpriority: high -> low
nosy: georg.brandl, rhettinger, pitrou, benjamin.peterson
title: some tests fail with Py_DEBUG (test_distutils, test_set) -> some tests fail with 'make EXTRA_CFLAGS="-DPy_DEBUG"' (test_distutils, test_set)
components: + Build
versions: + Python 3.1, - Python 3.0
2008-07-26 12:39:56pitrousettype: behavior -> crash
messages: + msg70300
components: + Tests
2008-07-26 12:37:07pitrousetpriority: high
assignee: georg.brandl
type: crash -> behavior
components: + Documentation, - Tests
title: some tests fail in debug mode (test_distutils, test_set) -> some tests fail with Py_DEBUG (test_distutils, test_set)
nosy: + georg.brandl
versions: + Python 2.6
messages: + msg70299
2008-07-15 06:01:17rhettingersetmessages: + msg69674
2008-07-14 23:17:44pitrousetmessages: + msg69667
2008-07-14 22:54:33benjamin.petersonsetnosy: + benjamin.peterson
messages: + msg69666
2008-07-14 21:45:36rhettingersetnosy: + rhettinger
messages: + msg69663
2008-07-14 21:15:26pitroucreate