python / python/cpython

`urlparse` ignores the `scheme` parameter when parsing a URL

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

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

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

説明

Bug report

Bug description:

urlparse ignores the scheme parameter when determining what part of a URL is the path and hostname.

from urllib.parse import urlparse
# This should be parsed as: http://www.example.com
parsed_url = urlparse('www.example.com', scheme='http')
print(parsed_url)
print(parsed_url.hostname)

ParseResult(scheme='http', netloc='', path='www.example.com', params='', query='', fragment='')
[empty string]

Should return:

ParseResult(scheme='http', netloc='', path='', params='', query='', fragment='')
www.example.com

Per the docs:

The scheme argument gives the default addressing scheme, to be used only if the URL does not specify one.

CPython versions tested on:

3.8, 3.11

Operating systems tested on:

Windows

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

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

はじめの一歩

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

調査の方向性

まず、サポート対象の CPython バージョンで報告された urlparse の動作を再現し、urllib.parse の実装と既存の URL パーステストを確認します。scheme 引数の扱いを文書化された動作と比較し、要求された hostname のパースが URL 構文と互換性があるかどうかを判断します。合意した動作が回帰テストでカバーされれば完了です。

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

評価

技術スタック
python
領域
networking
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
42/100

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

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