@@ -1647,8 +1647,9 @@ class Helper:
16471647 }
16481648 # Either add symbols to this dictionary or to the symbols dictionary
16491649 # directly: Whichever is easier. They are merged later.
1650+ _strprefixes = tuple (p + q for p in ('b' , 'r' , 'u' ) for q in ("'" , '"' ))
16501651 _symbols_inverse = {
1651- 'STRINGS' : ("'" , "'''" , "r'" , "u'" , '"""' , '"' , 'r"' , 'u"' ) ,
1652+ 'STRINGS' : ("'" , "'''" , '"""' , '"' ) + _strprefixes ,
16521653 'OPERATORS' : ('+' , '-' , '*' , '**' , '/' , '//' , '%' , '<<' , '>>' , '&' ,
16531654 '|' , '^' , '~' , '<' , '>' , '<=' , '>=' , '==' , '!=' , '<>' ),
16541655 'COMPARISON' : ('<' , '>' , '<=' , '>=' , '==' , '!=' , '<>' ),
@@ -1811,7 +1812,12 @@ def interact(self):
18111812 if not request : break
18121813 except (KeyboardInterrupt , EOFError ):
18131814 break
1814- request = strip (replace (request , '"' , '' , "'" , '' ))
1815+ request = strip (request )
1816+ # Make sure significant trailing quotation marks of literals don't
1817+ # get deleted while cleaning input
1818+ if (len (request ) > 2 and request [0 ] == request [- 1 ] in ("'" , '"' )
1819+ and request [0 ] not in request [1 :- 1 ]):
1820+ request = request [1 :- 1 ]
18151821 if lower (request ) in ('q' , 'quit' ): break
18161822 self .help (request )
18171823
0 commit comments