-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
bugSomething isn't workingSomething isn't workingfixesRelated to suggested fixes for violationsRelated to suggested fixes for violations
Description
Description
The fixes for unnecessary-generator-list (C400) and unnecessary-generator-set (C401) introduce syntax errors in Ruff 0.9.4 when a parenthesized generator comprehension is followed by a comma and the generator comprehension cannot be simplified to just the iterable.
$ cat >c40.py <<'# EOF'
list((0 for _ in []),)
set((0 for _ in []),)
# EOF
$ ruff --isolated check --preview --select C400 c40.py --unsafe-fixes --diff
error: Fix 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=%5BFix%20error%5D
...quoting the contents of `c40.py`, the rule codes C400, along with the `pyproject.toml` settings and executed command, we'd be very appreciative!
$ ruff --isolated check --preview --select C401 c40.py --unsafe-fixes --diff
error: Fix 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=%5BFix%20error%5D
...quoting the contents of `c40.py`, the rule codes C401, along with the `pyproject.toml` settings and executed command, we'd be very appreciative!
The syntactically incorrect output is presumably:
[0 for _ in [],]
{0 for _ in [],}(Is there a way to see this output instead of having Ruff revert the changes?)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingfixesRelated to suggested fixes for violationsRelated to suggested fixes for violations