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

Should not trigger on byte strings #22

Closed
ghost opened this issue Feb 20, 2022 · 2 comments · Fixed by #25
Closed

Should not trigger on byte strings #22

ghost opened this issue Feb 20, 2022 · 2 comments · Fixed by #25

Comments

@ghost
Copy link

ghost commented Feb 20, 2022

The following code triggers an FS001 error:

a = 42
b"y=%d" % a

However, using an f-string with a byte string is a syntax error:

>>> bf"y={a}"
  File "<stdin>", line 1
    bf"y={a}"
      ^^^^^^^
SyntaxError: invalid syntax

(In this particular case f"y={a}".encode("utf-8") would work, but that's longer and doesn't always work correctly if there are byte literals in my string.)

@MichaelKim0407
Copy link
Owner

OK I can take a look. Should be relatively easy to change.

Can you please check what greedy level you are using? If you are using level 2 then it would report an error anyway.

@ghost
Copy link
Author

ghost commented Feb 20, 2022

I'm using whatever is the default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant