Skip to content

test_capi failure when GIL disabled #115891

Closed
@smontanaro

Description

@smontanaro

Bug report

Bug description:

test_capi is failing reliably for me on Ubuntu 22.04 (Intel) and MacOS Sonoma (M1 Pro). Repeat with:

git clean -fdx
./configure
make
./python -E  -m test --fast-ci --timeout= test_capi
# test_capi succeeds
git clean -fdx
./configure --disable-gil
make
./python -E  -m test --fast-ci --timeout= test_capi
# test_capi fails

Output:

FAIL: test_pyobject_freed_is_freed (test.test_capi.test_mem.PyMemDebugTests.test_pyobject_freed_is_freed)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/skip/src/python/cpython/Lib/test/test_capi/test_mem.py", line 113, in test_pyobject_freed_is_freed
    self.check_pyobject_is_freed('check_pyobject_freed_is_freed')
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/skip/src/python/cpython/Lib/test/test_capi/test_mem.py", line 97, in check_pyobject_is_freed
    assert_python_ok(
    ~~~~~~~~~~~~~~~~^
        '-c', code,
        ^^^^^^^^^^^
        PYTHONMALLOC=self.PYTHONMALLOC,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        MALLOC_CONF="junk:false",
        ^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/Users/skip/src/python/cpython/Lib/test/support/script_helper.py", line 180, in assert_python_ok
    return _assert_python(True, *args, **env_vars)
           ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/skip/src/python/cpython/Lib/test/support/script_helper.py", line 165, in _assert_python
    res.fail(cmd_line)
    ~~~~~~~~^^^^^^^^^^
  File "/Users/skip/src/python/cpython/Lib/test/support/script_helper.py", line 75, in fail
    raise AssertionError("Process return code is %d\n"
    ...<13 lines>...
                            err))
AssertionError: Process return code is 1
command line: ['/Users/skip/src/python/cpython/python.exe', '-X', 'faulthandler', '-c', '\nimport gc, os, sys, _testinternalcapi\n# Disable the GC to avoid crash on GC collection\ngc.disable()\n_testinternalcapi.check_pyobject_freed_is_freed()\n# Exit immediately to avoid a crash while deallocating\n# the invalid object\nos._exit(0)\n']

stdout:
---

---

stderr:
---
Traceback (most recent call last):
  File "<string>", line 5, in <module>
    _testinternalcapi.check_pyobject_freed_is_freed()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
AssertionError: object is not seen as freed
---

I tried this on both MacOS Sonoma (14.3) and Dell (Intel) Ubuntu 22.04. Results were the same.

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux, macOS

Linked PRs

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions