python / python/cpython

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

Ouverte
#155,823 3 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

interpreter-core topic-JIT type-bug
Langage dominant
Python
Étoiles
77.2k
Forks
35.9k
Métriques de merge des PR
Métriques de PR en attente

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

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Reproduisez l’échec avec la suite wcmatch sur CPython 3.15 ou la branche main, puis inspectez tests/test_globmatch.py::TestGlobMatchSpecial::test_empty_pattern_lists et wcmatch/_wcparse.py:338. C’est terminé lorsque le test des listes de motifs vides et l’exécution de la suite complète s’effectuent sans l’AttributeError ni corruption JIT associée.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
python
Domaine
compilers
Type d'issue
Bug
Difficulté
3/5
Temps estimé
1-2 jours
Activité
À l'abandon
Clarté
Clairement spécifiée
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.