-
Notifications
You must be signed in to change notification settings - Fork 0
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
f-string parser: Check comments in f-strings #157
Comments
Old:
New:
I don't think the new error is good, and seems like a regression, right? |
Yeah, ideally we should preserve the old error message: the new expression inside should be like a new parse completely regarding matchings. |
We already handle the comments inside the f-strings (it just raises an error), so this seems more of an error message discussion. I'd say the new error message is no worse than the old one, since it sort of makes sense. You probably wouldn't put |
I think that this would be solved by moving the |
We can probably delay this since at the end this is about the error message and that doesn't necessarily need to be preserved |
There is an actual problem here as we are allowing comments inside any f-string (multi-lined or not). We may want to change the PEP or the implementation. CC: @isidentical @lysnikolaou what do you think? |
Can you give an example @pablogsal? If someone tries to use a comment inside an f-string expression, than anything after the comment (including the quote character itself) is considered invalid so I don't understand how it is possible to have a valid single-line f-string that also has a comment.
|
Ah, I forgot to specify how we are allowing them:
In this case, no error message is being triggered and the comment works. Before we were getting this:
I am using the |
Hummmmm, I apologize, but I think I was using the wrong branch for some reason. I am checking again and seems that this doesn't happen in the last |
In
test_fstring
the testtest_comments
fails. We need to check if is due to regular tokenization problems and the test needs updating or we need to fix something regarding comments in f-stringsThe text was updated successfully, but these errors were encountered: