Improve `__repr__` string of synchronize tools in the `multiprocessing` module.
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ả
Feature or enhancement
Proposal:
To be consistant with representation string of threading sychronize tools and in accordance with the discussion from the #149447 PR , the missing id information must be added in the __repr__ of the following synchronization classes:
Lock,Rlock,Semaphore,BoundedSemaphore,Condition.
and refactoring must be performed to these 2 classes:
Event,Barrier.
See some examples below:
import threading
import multiprocessing
print(threading.Semaphore(3))
print(multiprocessing.Semaphore(3))
print(threading.Lock())
print(multiprocessing.Lock())
print(threading.Event())
print(multiprocessing.Event())
print(threading.Barrier(2))
print(multiprocessing.Barrier(2))
The ouput is:
<threading.Semaphore at 0x10378c8a0: value=3>
<Semaphore(value=3)>
<unlocked _thread.lock object at 0x103612040>
<Lock(owner=None)>
<threading.Event at 0x10378ccc0: unset>
<Event at 0x10378ccc0 unset>
<threading.Barrier at 0x10378ccc0: waiters=0/2>
<multiprocessing.synchronize.Barrier at 0x10378ccc0: waiters=0/2>
A PR will be published soon.
cc @gpshead
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
#149447
Linked PRs
- gh-155593
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 trong module multiprocessing với các class Lock, Rlock, Semaphore, BoundedSemaphore, Condition, Event và Barrier, so sánh các biểu diễn của chúng với threading và phần thảo luận trong #149447. Được coi là hoàn tất khi thông tin id được yêu cầu đã được đưa vào cho các công cụ đồng bộ hóa được liệt kê, đồng thời Event và Barrier nhận được refactoring được đề xuất; lưu ý rằng PR #155593 đã được liên kết trong issue.
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
- operating-systems
- Loại issue
- Tính năng
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 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
- 35/100