python / python/cpython

Should `socketserver.BaseServer` have abstract methods?

Đang mở
#127,209 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

stdlib topic-socket type-feature
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:

socketserver.BaseServer is documented to have the methods fileno, get_request, and server_bind, but it doesn't actually have these. They're implemented on the subclass TCPServer instead, and TCPServer is the only direct subclass of BaseServer in the standard library. Of the three methods, get_request is the only one called within any existing methods of BaseServer.

This seems like a situation where BaseServer is acting as an ABC with these methods expected to be implemented by any subclass. Abstract methods weren't available yet when socketserver was added. Does it make sense to use them now? I couldn't find anyone suggesting this on the issue tracker or on discuss.python.org, so I don't know if this has been considered and rejected before, or never really considered.

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:

No response

Linked PRs
  • gh-127976

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu với các entry point socketserver.BaseServer và TCPServer, tập trung vào fileno, get_request và server_bind, cũng như cách BaseServer hiện đang sử dụng chúng. Xem xét PR được liên kết gh-127976 và xác định liệu việc biến các phương thức này thành abstract có duy trì contract đã được tài liệu hóa của các subclass hay không; được xem là hoàn thành khi đạt được một quyết định được tài liệu hóa cùng với phần triển khai và validation tương ứng.

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
networking
Loại issue
Tính năng
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
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

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.