Skip to content

bpo-45494: Fix parser crash when reporting errors involving invalid continuation characters #28993

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

Merged
merged 1 commit into from
Oct 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Lib/test/test_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,10 @@ def check(self, src, lineno, offset, encoding='utf-8'):
src = src.decode(encoding, 'replace')
line = src.split('\n')[lineno-1]
self.assertIn(line, cm.exception.text)

def test_error_offset_continuation_characters(self):
check = self.check
check('"\\\n"(1 for c in I,\\\n\\', 2, 2)

def testSyntaxErrorOffset(self):
check = self.check
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix parser crash when reporting errors involving invalid continuation
characters. Patch by Pablo Galindo.
Loading