python / python/cpython

Difference in _use_fd_functions in shutil.py and test_shutil.py

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

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

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

説明

Bug report

Bug description:

When switching from os.listdir to os.scandir 7 years ago somebody forgot to update the definition of _use_fd_functions in test_shutil together with shutil module.

in shutil:

_use_fd_functions = ({os.open, os.stat, os.unlink, os.rmdir} <=
                     os.supports_dir_fd and
                     os.scandir in os.supports_fd and
                     os.stat in os.supports_follow_symlinks)

in test_shutil:

        _use_fd_functions = ({os.open, os.stat, os.unlink, os.rmdir} <=
                             os.supports_dir_fd and
                             os.listdir in os.supports_fd and
                             os.stat in os.supports_follow_symlinks)

I believe there is no need to calculate this variable twice so I'm gonna propose a PR where I use the value from shutil.py in its tests. Nobody will ever forget to update both places again.

CPython versions tested on:

CPython main branch

Operating systems tested on:

No response

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

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

はじめの一歩

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

調査の方向性

まず shutil.py と test_shutil.py の _use_fd_functions の定義を比較し、次にテスト側の値がどのように使用されているかを調べます。現在の動作を確認するために shutil のテストを実行し、テストがカバレッジやプラットフォーム固有の動作を変更せずにモジュールの単一の値を使用していることを確認します。

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

評価

技術スタック
python
領域
testing-qa
issue の種類
バグ
難易度
2/5
見積もり時間
1〜3時間
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
55/100

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

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