python / python/cpython

optimize code for proxy handling of `urllib.request`

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

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

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

説明

Feature or enhancement

Proposal:
  1. the second loop of line starts from 1845 is duplicated from the first loop.
    https://github.com/python/cpython/blob/2041a95e68ebf6d13f867e214ada28affa830669/Lib/urllib/request.py#L1817-L1853
  2. the registry access should be separated to a standalone function for cache, to be used by code like https://github.com/aio-libs/aiohttp/blob/e79b2d5df70a2644e81925cc49558962af91848d/aiohttp/client.py#L609-L617
    https://github.com/python/cpython/blob/2041a95e68ebf6d13f867e214ada28affa830669/Lib/urllib/request.py#L2071-L2104
  3. the proxy setting from registry should be ignored when if proxies from environment exists? like the proxy_bypass()

Should open a PR?

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-127767

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

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

はじめの一歩

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

調査の方向性

Lib/urllib/request.py の 1817-1853 行付近と 2071-2104 行付近から始め、リンク先の aiohttp のプロキシ処理と比較してください。目標にループの重複排除、キャッシュされたレジストリへのアクセスの切り出し、環境プロキシの優先が含まれるかを明確にしてください。合意したプロキシ動作が実装され、適切な urllib.request テストでカバーされていれば完了です。

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

評価

技術スタック
python
領域
networking
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

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

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