python / python/cpython

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

Đang mở
#155,823 3 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

interpreter-core topic-JIT type-bug
Ngôn ngữ chính
Python
Star
77.2k
Fork
35.9k
Chỉ số merge pull request
Chỉ số pull request đang chờ

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Tái hiện lỗi với bộ kiểm thử wcmatch trên CPython 3.15 hoặc nhánh main, sau đó kiểm tra tests/test_globmatch.py::TestGlobMatchSpecial::test_empty_pattern_lists và wcmatch/_wcparse.py:338. Công việc được xem là hoàn tất khi bài kiểm thử danh sách pattern rỗng và toàn bộ bộ kiểm thử chạy mà không gặp AttributeError hoặc lỗi hỏng JIT liên quan.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
python
Lĩnh vực
compilers
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.