python / python/cpython

Should `socketserver.BaseServer` have abstract methods?

オープン
#127,209 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

stdlib topic-socket type-feature
主要言語
Python
スター
77.2k
フォーク
36k
PR マージ指標
PR 指標を取得中

説明

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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

socketserver.BaseServer と TCPServer のエントリポイントから始め、fileno、get_request、server_bind、および BaseServer が現在それらをどのように使用しているかに重点を置きます。リンクされている PR gh-127976 を確認し、これらのメソッドを abstract にすることで、文書化されたサブクラスの契約が維持されるかどうかを判断します。対応する実装と検証を伴う文書化された判断に到達すれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
networking
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。