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

bpo-40335: Correctly handle multi-line strings in tokenize error scenarios #19619

Merged
merged 2 commits into from Apr 21, 2020

Conversation

pablogsal
Copy link
Member

@pablogsal pablogsal commented Apr 20, 2020

@pablogsal
Copy link
Member Author

CC: @asottile Can you check if this PR runs correctly with your test suite?

@asottile
Copy link
Contributor

yep pyflakes is now passing (with a minor patch, but this patch is expected):

$ git diff
diff --git a/pyflakes/test/test_api.py b/pyflakes/test/test_api.py
index 128aa69..b579ac8 100644
--- a/pyflakes/test/test_api.py
+++ b/pyflakes/test/test_api.py
@@ -449,6 +449,8 @@ def baz():
         with self.makeTempFile(source) as sourcePath:
             if PYPY:
                 message = 'end of file (EOF) while scanning triple-quoted string literal'
+            elif sys.version_info >= (3, 9):
+                message = 'invalid string prefix'
             else:
                 message = 'invalid syntax'
 

@pablogsal
Copy link
Member Author

but this patch is expected

Yeah, that was on purpose 😉

@lysnikolaou
Copy link
Contributor

lysnikolaou commented Apr 20, 2020

Thanks, @pablogsal, for the fix! 😃

Copy link
Member

@gvanrossum gvanrossum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weak approve: I don't feel super confident with the ins and outs of this code, but if the tests pass, I feel it's fine.

Lib/test/test_exceptions.py Outdated Show resolved Hide resolved
Co-Authored-By: Guido van Rossum <gvanrossum@gmail.com>
@pablogsal pablogsal merged commit 11a7f15 into python:master Apr 21, 2020
@pablogsal pablogsal deleted the bpo-40335 branch May 19, 2021 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants