Skip to content

Commit

Permalink
bpo-40661: Fix segfault when parsing invalid input (pythonGH-20165)
Browse files Browse the repository at this point in the history
Fix segfaults when parsing very complex invalid input, like `import äˆ ð£„¯ð¢·žð±‹á”€ð””ð‘©±å®ä±¬ð©¾\n𗶽`.

Co-authored-by: Guido van Rossum <[email protected]>
Co-authored-by: Pablo Galindo <[email protected]>
  • Loading branch information
3 people authored May 18, 2020
1 parent 08b47c3 commit 7b7a21b
Show file tree
Hide file tree
Showing 4 changed files with 1,603 additions and 8 deletions.
1 change: 1 addition & 0 deletions Lib/test/test_peg_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,7 @@ def f(*a, b):
("f-string_single_closing_brace", "f'}'"),
("from_import_invalid", "from import import a"),
("from_import_trailing_comma", "from a import b,"),
("import_non_ascii_syntax_error", "import ä £"),
# This test case checks error paths involving tokens with uninitialized
# values of col_offset and end_col_offset.
("invalid indentation",
Expand Down
3 changes: 3 additions & 0 deletions Lib/test/test_syntax.py
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,9 @@
Traceback (most recent call last):
SyntaxError: cannot assign to __debug__
>>> import ä £
Traceback (most recent call last):
SyntaxError: invalid character '£' (U+00A3)
"""

import re
Expand Down
Loading

0 comments on commit 7b7a21b

Please sign in to comment.