Skip to content

ctypes does crash on AMD64 FreeBSD Shared 3.x #92752

@vstinner

Description

@vstinner

test_gc.test_refcount_errors() fails on AMD64 FreeBSD Shared 3.x since build 2367 (May 12 at 6:57 AM, 17 hours ago):
https://buildbot.python.org/all/#/builders/483/builds/2367

FAIL: test_refcount_errors (test.test_gc.GCCallbackTests.test_refcount_errors)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-564d/build/Lib/test/test_gc.py", line 1269, in test_refcount_errors
    self.assertRegex(stderr,
    ^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: Regex didn't match: b'gcmodule\\.c:[0-9]+: gc_decref: Assertion "gc_get_refs\\(g\\) > 0" failed.' not found in b''

The problem is the call to Py_DecRef() function using ctypes:

            # Simulate the refcount of "a" being too low (compared to the
            # references held on it by live data), but keeping it above zero
            # (to avoid deallocating it):
            import ctypes
            ctypes.pythonapi.Py_DecRef(ctypes.py_object(a))

It does crash with SIGILL on this FreeBSD machine.

test_ctypes also crash:

test_2 (ctypes.test.test_array_in_pointer.Test.test_2) ... Fatal Python error: Segmentation fault

Current thread 0x0000000826cf2000 (most recent call first):
  File "/usr/home/haypo/cpython/Lib/ctypes/__init__.py", line 512 in cast
  File "/usr/home/haypo/cpython/Lib/ctypes/test/test_array_in_pointer.py", line 50 in test_2

test_bytes:

test_from_format (test.test_bytes.BytesTest.test_from_format) ... Fatal Python error: Segmentation fault

Current thread 0x0000000826ffd000 (most recent call first):
  File "/usr/home/haypo/cpython/Lib/test/test_bytes.py", line 1055 in test_from_format

In fact, many tests are failing:

1 test failed:
    test_gc

20 tests skipped:
    test_dbm_gnu test_devpoll test_epoll test_idle test_ioctl
    test_launcher test_msilib test_readline test_spwd test_startfile
    test_tcl test_tix test_tk test_ttk_guionly test_ttk_textonly
    test_turtle test_winconsoleio test_winreg test_winsound
    test_zipfile64

7 re-run tests:
    test_bytes test_code test_ctypes test_embed test_gc test_threading
    test_unicode

6 tests run no tests:
    test_bytes test_code test_ctypes test_embed test_threading
    test_unicode

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions