Free threaded: slicing a shared memoryview raises `ValueError: operation forbidden on released memoryview object`
還沒有人認領這個 Issue。
- 主要語言
- Python
- 星號
- 77.2k
- 分支
- 35.9k
- PR 合併指標
- PR 指標待擷取
描述
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
- gh-155882
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
從附帶的 repro_shared_memoryview_threads.py 指令碼開始,並比較其在 Python 3.15 中使用 PYTHON_GIL=0 和 PYTHON_GIL=1 時的結果。調查 free-threaded runtime 中 shared memoryview 的行為;當並行切片不再引發報告中的 ValueError 時,即表示完成。連結的 PR gh-155882 表明相關工作已經在進行中。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- python
- 領域
- backend
- Issue 類型
- 缺陷
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 25/100