Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C400 unsafe fix is more unsafe than the documentation suggests #11603

Closed
simonpercivall opened this issue May 29, 2024 · 1 comment · Fixed by #11607
Closed

C400 unsafe fix is more unsafe than the documentation suggests #11603

simonpercivall opened this issue May 29, 2024 · 1 comment · Fixed by #11607
Assignees
Labels
bug Something isn't working fixes Related to suggested fixes for violations

Comments

@simonpercivall
Copy link

Ruff 0.45

The C400 unsafe fix says that that it sometimes drops comments. It may also generate broken code:

ruff check fix --unsafe-fixes --select C400

list(
    (1 for _ in range(1))
)

expected

[
    1 for _ in range(1)
]  # [1]

actual

[
    (1 for _ in range(1))
]  # [<generator object <genexpr> at ...>
@AlexWaygood AlexWaygood added bug Something isn't working fixes Related to suggested fixes for violations labels May 29, 2024
@charliermarsh
Copy link
Member

👍 Yeah that's a bug (rather than a question of fix safety). Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixes Related to suggested fixes for violations
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants