Open
Description
Describe the issue:
A test that invokes C APIs segfaults when run from multiple threads in parallel in python 3.13t:
numpy/numpy/_core/tests/test_dtype.py
Lines 1920 to 1925 in ff1d6cc
The test invokes a test-specific C function, which however upon cursory inspection doesn't seem to have anything untowards in it. The C function in turn calls: Py_SET_TYPE
, PyArray_RegisterDataType
, PyArray_DescrFromType
:
Reproduce the code example:
- deploy numpy through https://github.com/rgommers/pixi-dev-scipystack/
- apply patch (see DEV: stop monkeypatching and use of
autouse=True
fixtures by default in test suite #29090):
--- a/numpy/conftest.py
+++ b/numpy/conftest.py
@@ -147,9 +147,10 @@ def check_fpu_mode(request):
def add_np(doctest_namespace):
doctest_namespace['np'] = numpy
+
@pytest.fixture(autouse=True)
-def env_setup(monkeypatch):
- monkeypatch.setenv('PYTHONHASHSEED', '0')
+def env_setup():
+ os.environ['PYTHONHASHSEED'] = '0'
- pixi run test-nogil -- -k test_custom_structured_dtype --parallel-threads=32
Python and NumPy Versions:
python 3.13t
numpy git tip 2025-06-04
Runtime Environment:
32-core x86_64 Linux host
Metadata
Metadata
Assignees
Labels
PRs and issues related to support for free-threading CPython (a.k.a. no-GIL, PEP 703)PRs and issues related to support for free-threading CPython (a.k.a. no-GIL, PEP 703)