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

[Autofix error] Autofix error with if statement #3619

Closed
qarmin opened this issue Mar 20, 2023 · 6 comments
Closed

[Autofix error] Autofix error with if statement #3619

qarmin opened this issue Mar 20, 2023 · 6 comments
Labels
bug Something isn't working

Comments

@qarmin
Copy link

qarmin commented Mar 20, 2023

Ruff a45753f

def _parseline(path: str, line: str, lineno: int) -> tuple[str | None, str | None]:
    if iscommentline(line):
        line = ""
    else:
        line = *line.rstrip()

25633_parse9.py.zip

with

ruff file.py --fix
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/charliermarsh/ruff/issues/new?title=%5BAutofix%20error%5D

...quoting the contents of `Desktop/RunEveryCommand/Ruff/Broken/17333_parse90.py`, along with the `pyproject.toml` settings and executed command, we'd be very appreciative!
@charliermarsh charliermarsh added the bug Something isn't working label Mar 20, 2023
@charliermarsh
Copy link
Member

Is the initial example valid Python? I can't get that to parse under Python 3.11.

@charliermarsh
Copy link
Member

charliermarsh commented Mar 20, 2023

❯ python foo.py
  File "/Users/crmarsh/workspace/ruff/foo.py", line 5
    line = *line.rstrip()
           ^^^^^^^^^^^^^^
SyntaxError: can't use starred expression here

@charliermarsh charliermarsh added the question Asking for support or clarification label Mar 20, 2023
@qarmin
Copy link
Author

qarmin commented Mar 21, 2023

I cannot find original file with this lines.

I tried to run this with several python versions and with each I had parse error, so the problem here is probably with recognizing this file by ruff as valid

@charliermarsh
Copy link
Member

I think it's an error that Ruff doesn't flag the original source as invalid syntax.

@charliermarsh charliermarsh removed the question Asking for support or clarification label Mar 21, 2023
@qarmin
Copy link
Author

qarmin commented May 28, 2023

Such files I reported upstream - RustPython/Parser#66

@charliermarsh
Copy link
Member

I'm going to close this one in favor of the RustPython issue.

@charliermarsh charliermarsh closed this as not planned Won't fix, can't repro, duplicate, stale Jun 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants