Free threaded: slicing a shared memoryview raises `ValueError: operation forbidden on released memoryview object`
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Python
- Star
- 77.2k
- Fork
- 35.9k
- Chỉ số merge pull request
- Chỉ số pull request đang chờ
Mô tả
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
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu với script repro_shared_memoryview_threads.py được đính kèm và so sánh kết quả của nó với PYTHON_GIL=0 và PYTHON_GIL=1 trên Python 3.15. Điều tra hành vi của shared memoryview trong runtime free-threaded; công việc được xem là hoàn tất khi việc slicing đồng thời không còn gây ra ValueError đã được báo cáo. PR được liên kết gh-155882 cho biết công việc đã được tiến hành.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- python
- Lĩnh vực
- backend
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 25/100