python / python/cpython

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

Abierto
#155,823 3 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

interpreter-core topic-JIT type-bug
Lenguaje dominante
Python
Estrellas
77.2k
Forks
35.9k
Métricas de merge de PR
Métricas de PR pendientes

Descripción

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

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Reproduce el fallo con la suite de wcmatch en CPython 3.15 o en la rama main y, después, inspecciona tests/test_globmatch.py::TestGlobMatchSpecial::test_empty_pattern_lists y wcmatch/_wcparse.py:338. Se considera terminado cuando la prueba de listas de patrones vacías y la ejecución de la suite completa se realicen sin el AttributeError ni una corrupción de JIT relacionada.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
python
Área
compilers
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bien especificado
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.