python / python/cpython

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

Open
#155,823 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

interpreter-core topic-JIT type-bug
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with the wcmatch suite on CPython 3.15 or the main branch, then inspect tests/test_globmatch.py::TestGlobMatchSpecial::test_empty_pattern_lists and wcmatch/_wcparse.py:338. Done means the empty-pattern-list test and complete suite run without the AttributeError or related JIT corruption.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.