Confusing behavior of selectors with buffered file objects
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 48/100
- Loại issue
- Tài liệu
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- python
- Lĩnh vực
- documentation
Hướng nghiên cứu
Bắt đầu với tài liệu về selectors và hành vi của BufferedIOBase được đề cập trong issue, sau đó so sánh các ví dụ sử dụng sys.stdin và socket.makefile(). Xác định xem phạm vi là một cảnh báo trong tài liệu hay hỗ trợ triển khai cho dữ liệu được đệm. Được xem là hoàn tất khi hành vi được chọn được ghi lại rõ ràng, bao gồm khuyến nghị os.read(fileobj.fileno(), size) nếu thay đổi vẫn chỉ giới hạn ở tài liệu.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Using selectors with buffered file objects is confusing because the selector will only report whether there is something to read in the underlying file descriptor and ignore the internal buffer. This is especially relevant because buffered file objects are used in many places in the standard library, e.g. sys.stdin or socket.makefile().
I propose to add a corresponding warning to the docs, e.g. like this:
Selectors only look at the underlying file descriptors, so they do not know about data that is buffered in python code. Buffered file objects are used in many places in the standard library, e.g.
sys.stdinorsocket.makefile(). In those cases, it is recommended to bypass the buffering by usingos.read(fileobj.fileno(), size)instead offileobj.read(size).
Even better would be add code to handle buffered file objects. Unfortunately, I think that BufferedIOBase does not expose whether it has data in its buffer.
- Ngôn ngữ chính
- Python
- Star
- 77.2k
- Fork
- 36k
- Merge trung bình
- 1 ngày 9 giờ
- Pull request đã merge (30 ngày)
- 558
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.
Issue khác của python/cpython
-
docs pending
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
stdlib type-feature
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
stdlib type-feature
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
build type-bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
-
stdlib topic-email type-feature
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Tất cả issue của python/cpython
Issue tương tự
-
area/auth bug comp/agent P3 platform/discord type/security
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
NousResearch/hermes-agent#117848 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
bancolombia/sentinel#23 ·
-
test md Đang mởCI
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
langchain-ai/deepagents#6450 ·
-
bug client
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100