IPv4Interface.is_loopback ignores the network prefix, unlike IPv6Interface
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 77.2k
- フォーク
- 35.9k
- PR マージ指標
- PR 指標を取得中
説明
Bug report
Bug description:
IPv4Interface does not override is_loopback, so it inherits IPv4Address.is_loopback and only checks the host address, ignoring the network. IPv6Interface, on the other hand, checks both the address and the network:
>>> import ipaddress
>>> ipaddress.IPv4Interface('127.0.0.1/4').is_loopback
True
>>> ipaddress.IPv4Interface('127.0.0.1/4').network.is_loopback
False
>>> ipaddress.IPv6Interface('::1/64').is_loopback
False
127.0.0.1/4 has a network of 112.0.0.0/4, which is not within the loopback range 127.0.0.0/8, yet is_loopback returns True.
This is the same class of inconsistency already fixed for is_unspecified in gh-115766: an interface property should consider both the address and its network. IPv6Interface.is_loopback already does this:
@property
def is_loopback(self):
return super().is_loopback and self.network.is_loopback
IPv4Interface should get the same override for consistency.
Note this is a behavior change (127.0.0.1/4 etc. would change from True to False).
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Linked PRs
- gh-151786
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
IPv4Interface.is_loopback から始め、issue に示されている IPv6Interface の実装と比較してください。既存の ipaddress テストを確認し、インターフェースが自身のアドレスとネットワークの両方を考慮することを確認してください。これには、文書化されている 127.0.0.1/4 の動作も含まれます。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- networking
- issue の種類
- バグ
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 35/100