Skip to content

Rule C416 cause autofix error #7196

@qarmin

Description

@qarmin

Ruff 0.0.287 (latest changes from main branch)

ruff  *.py --select C416 --no-cache --fix

file content(at least simple cpython script shows that this is valid python file):

class DefinitionParserOutput:
        assert any(len(symbol_table.get_by_type(symbol_type)) > 0 for symbol_type in[t for t in SymbolType]), \
           "DefinitionParserOutput: symbol table has not been populated by objects of any type."

error

/home/rafal/test/tmp_folder/619_IDX_0_RAND_40390906914543499371195.py:2:85: C416 Unnecessary `list` comprehension (rewrite using `list()`)
Found 1 error.

error: Autofix introduced a syntax error. Reverting all changes.

This indicates a bug in `ruff`. If you could open an issue at:

    https://github.com/astral-sh/ruff/issues/new?title=%5BAutofix%20error%5D

...quoting the contents of `/home/rafal/test/tmp_folder/619_IDX_0_RAND_40390906914543499371195.py`, the rule codes C416, along with the `pyproject.toml` settings and executed command, we'd be very appreciative!

python_compressed.zip

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingfuzzerSurfaced via fuzzing.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions