Bug report
Bug description:
Hello (and thanks for your amazing work),
I found that, on free threading Python, slicing a shared memoryview from several threads raises ValueError: operation forbidden on released memoryview object, even though nothing calls .release() and the underlying object is an immutable bytes. Stock (GIL) builds are unaffected.
data = bytes(1 << 20)
mv = memoryview(data) # ONE view, shared
# in each of 8 threads: bytes(mv[0:64])
See the attached reproduction script. Results are not deterministic: not all threads raise an exception. Here are the results on my machine after running it:
$ PYTHON_GIL=0 python3.15t repro_shared_memoryview_threads.py
python 3.15.0rc1 gil_enabled=False: 3/8 threads FAILED -> ValueError('operation forbidden on released memoryview object')
$ PYTHON_GIL=1 python3.15t repro_shared_memoryview_threads.py
python 3.15.0rc1 gil_enabled=True: all 8 threads OK
CPython versions tested on:
3.15
Operating systems tested on:
Linux
Linked PRs
Reactions are currently unavailable
Bug report
Bug description:
Hello (and thanks for your amazing work),
I found that, on free threading Python, slicing a shared memoryview from several threads raises ValueError: operation forbidden on released memoryview object, even though nothing calls .release() and the underlying object is an immutable bytes. Stock (GIL) builds are unaffected.
See the attached reproduction script. Results are not deterministic: not all threads raise an exception. Here are the results on my machine after running it:
$ PYTHON_GIL=0 python3.15t repro_shared_memoryview_threads.py python 3.15.0rc1 gil_enabled=False: 3/8 threads FAILED -> ValueError('operation forbidden on released memoryview object') $ PYTHON_GIL=1 python3.15t repro_shared_memoryview_threads.py python 3.15.0rc1 gil_enabled=True: all 8 threads OKCPython versions tested on:
3.15
Operating systems tested on:
Linux
Linked PRs