python / python/cpython

JIT corruption in `wcmatch` test suite: `yield from []` triggers "AttributeError: 'list' object has no attribute 'send'"

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

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

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

説明

Bug report

Bug description:

When running wcmatch 15.0.1 complete test suite (doesn't happen with parts of it, or the older version), I'm seeing the following corruption:

$ uv venv -p ~/cpython/python
Using CPython 3.16.0a0 interpreter at: /home/mgorny/cpython/python
Creating virtual environment at: .venv
Activate with: source .venv/bin/activate
$ uv pip install -e . pytest
Resolved 7 packages in 659ms
      Built wcmatch @ file:///home/mgorny/wcmatch                                                                                      
Prepared 1 package in 210ms
Installed 7 packages in 58ms
 + bracex==3.0.1
 + iniconfig==2.3.0
 + packaging==26.3
 + pluggy==1.6.0
 + pygments==2.20.0
 + pytest==9.1.1
 + wcmatch==11.0.1 (from file:///home/mgorny/wcmatch)
$ .venv/bin/pytest
========================================================= test session starts =========================================================
platform linux -- Python 3.16.0a0, pytest-9.1.1, pluggy-1.6.0
rootdir: /home/mgorny/wcmatch
configfile: pyproject.toml
collected 1409 items                                                                                                                  

tests/test_fnmatch.py ......................................................................................................... [  7%]
................................................................s...............................                                [ 14%]
tests/test_glob.py ....s..s.................s.s..s.s..s.........sssssss.......s.ssss........s.s..............s.........s.s..... [ 21%]
........s..s.................s.s..s.s..s.........sssssss.......s.ssss........s.s..............s.........s.s......s............. [ 30%]
.s..s......s.s.........ssssss....s..s.................s.s..s.s..s.........sssssss.......s.ssss........s.s..............s....... [ 39%]
..s.s........sss..s...............                                                                                              [ 42%]
tests/test_globmatch.py ss...............s.s.s..........s...............................................s............s...s..... [ 49%]
s.s....s....s...s.s......s..s......s......s..........................s.......s.......................................s...s..... [ 58%]
...................s..s.s........s..s....s.s.....s.....ss...............s.s.s..........s....................................... [ 67%]
........s............s...s.....s.s....s....s...s.s......s..s......s......s..........................s.......s.................. [ 76%]
.....................s...s........................s..s.s........s..s....s.s.....s.............................................. [ 85%]
...............................F..........s.......................................................                              [ 92%]
tests/test_pathlib.py .........................................................                                                 [ 96%]
tests/test_versions.py ....                                                                                                     [ 97%]
tests/test_wcmatch.py ..........................                                                                                [ 98%]
tests/test_wcparse.py ................                                                                                          [100%]

============================================================== FAILURES ===============================================================
____________________________________________ TestGlobMatchSpecial.test_empty_pattern_lists ____________________________________________

self = <tests.test_globmatch.TestGlobMatchSpecial testMethod=test_empty_pattern_lists>

    def test_empty_pattern_lists(self):
        """Test empty pattern lists."""
    
>       self.assertFalse(glob.globmatch('test', []))
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/test_globmatch.py:1021: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
wcmatch/glob.py:1005: in globmatch
    return _wcparse.compile(
wcmatch/_wcparse.py:759: in compile
    positive, negative = compile_pattern(patterns, flags, limit, exclude)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
wcmatch/_wcparse.py:718: in compile_pattern
    for pattern in iter_patterns(patterns):
                   ^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

patterns = []

    def iter_patterns(patterns: AnyStr | Sequence[AnyStr]) -> Iterable[AnyStr]:
        """Return a simple string sequence."""
    
        if isinstance(patterns, (str, bytes)):
            yield patterns
        else:
>           yield from patterns
E           AttributeError: 'list' object has no attribute 'send'

wcmatch/_wcparse.py:338: AttributeError
======================================================= short test summary info =======================================================
FAILED tests/test_globmatch.py::TestGlobMatchSpecial::test_empty_pattern_lists - AttributeError: 'list' object has no attribute 'send'
============================================ 1 failed, 1257 passed, 151 skipped in 12.57s =============================================
CPython versions tested on:

3.15, CPython main branch

Operating systems tested on:

Linux

Linked PRs
  • gh-155844

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

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

はじめの一歩

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

調査の方向性

CPython 3.15 または main ブランチで wcmatch スイートの失敗を再現し、その後 tests/test_globmatch.py::TestGlobMatchSpecial::test_empty_pattern_lists と wcmatch/_wcparse.py:338 を調査します。empty-pattern-list テストとスイート全体の実行が、AttributeError や関連する JIT の破損なしに完了すれば完了です。

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

評価

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

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

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