Add checking if both strings are the same in `SequenceMatcher.find_longest_match`
オープン
まだ誰も着手していません。
performance
stdlib
type-feature
- 主要言語
- Python
- スター
- 77.2k
- フォーク
- 35.9k
- PR マージ指標
- PR 指標を取得中
説明
Feature or enhancement
Proposal:
Add checking if sequences a[alo:ahi] and b[blo:bhi] are the same on the beginning of the method find_longest_match in SequenceMatcher. For identical sequences there is no reason to run whole logic when simple check can be done. It appears to fix issue when comparing two slightly different strings ends up with waiting forever for the result. This solves problem reported here https://github.com/pytest-dev/pytest/issues/8998
Proposed fix:
if a[alo:ahi] == b[blo:bhi]:
return Match(alo, blo, len(a[alo:ahi]))
Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
No response
Linked PRs
- gh-132167
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
SequenceMatcher.find_longest_match から始め、要求されたシーケンス比較をどのように処理しているか確認してください。ハングする動作について、リンクされている pytest レポートを確認してから、同一の文字列と少し異なる文字列を対象とした集中的なカバレッジを追加してください。最適化が返される match を変更せずに機能すれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- backend
- issue の種類
- 機能追加
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 25/100