Skip to content

Commit aadb371

Browse files
Bugfix in completer: don't hang when pasting a long string with many backslashes.
1 parent bdaf477 commit aadb371

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

ptpython/completer.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ def double_quoted_wrapper(text):
6262
grammar = r"""
6363
# Text before the current string.
6464
(
65-
[^'"#] | # Not quoted characters.
66-
''' ([^']|'[^']|''[^']|\\.)* ''' | # Inside single quoted triple strings
67-
"" " ([^"]|"[^"]|""[^"]|\\.)* "" " | # Inside double quoted triple strings
65+
[^'"#] | # Not quoted characters.
66+
''' ([^'\\]|'(?!')|''(?!')|\\.])* ''' | # Inside single quoted triple strings
67+
"" " ([^"\\]|"(?!")|""(?!^)|\\.])* "" " | # Inside double quoted triple strings
6868
6969
\#[^\n]*(\n|$) | # Comment.
7070
"(?!"") ([^"\\]|\\.)*" | # Inside double quoted strings.

0 commit comments

Comments
 (0)