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

raw-format string will be recognized as an error #197

Open
eternal-io opened this issue Aug 23, 2021 · 3 comments
Open

raw-format string will be recognized as an error #197

eternal-io opened this issue Aug 23, 2021 · 3 comments
Labels

Comments

@eternal-io
Copy link

Code snippet:

im.convert('1').save(rf'script\temp\{ord(c)}.png')
                                           ^ SyntaxError: invalid syntax *jedi*

rf - a convenient way of invoiding anomalous backslash in string, isn't it?

@davidhalter davidhalter transferred this issue from davidhalter/jedi Aug 23, 2021
@davidhalter
Copy link
Owner

Moved to the parso issue tracker, but i agree that this is a bug.

@davidhalter
Copy link
Owner

Oddly enough this was only introduced in 0.8.1. In 0.8.0 this was still working.

Git bisect shows me d39aadc. I think it makes sense that this is the reason, because it changed some stuff regarding f-strings and backslashes in them.

git bisect start
git bisect good v0.8.0
git bisect bad master
git bisect run python3 -c "import jedi; assert jedi.Script('''im.convert('1').save(rf'script\temp\{ord(c)}.png')\n''').get_syntax_errors() == []"

This uses Jedi, I'm 99% sure it also works with Jedi. The git repo is parso.

@davidhalter
Copy link
Owner

Tagging @thatch, because he might now more (since he wrote dc9aadc). If you're interested in fixing the problem I'm happy to help.

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

No branches or pull requests

2 participants