Some Runtime Finalization Constraints Are Not Enforced Nor Documented
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:
There are a few technical constraints on calling Py_Finalize() currently aren't enforced, well-documented, or widely recognized. This is partly due to the relatively small number of embedders and the even smaller number of them that might violate the constraints through the use of threads or subinterpreters.
The constraints are:
- should be called only in the main thread
- should be called only with the main interpreter active
- should be called only using the same thread state used for
Py_Initialize()
(That last one is potentially less critical.)
There are several reasons these matter:
- the main thread of the main interpreter has a special role in the runtime's lifecycle
- the main thread of the main interpreter has unique responsibilities that must be synchronized with finalization
- conceptually, runtime lifecycle is an app-level function, and the app is typically driven through the "main" thread
The constraints should be documented, tested, and (possibly) enforced.
CPython versions tested on:
CPython main branch
Operating systems tested on:
No response
Linked PRs
- gh-120839
- gh-120840
- gh-120841
- gh-120852
- gh-120853
- gh-121010
- gh-121013
- gh-121063
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 bằng cách lần theo điểm vào Py_Finalize() và xem xét các PR được liên kết gh-120839, gh-120840, gh-120841, gh-120852, gh-120853, gh-121010, gh-121013 và gh-121063. Công việc được coi là hoàn tất khi các ràng buộc về main-thread, main-interpreter và initialization-thread-state được ghi lại, được kiểm thử bao phủ và có thể được thực thi.
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
- 20/100