[2.7] bpo-33422: Fix quotation marks getting deleted when looking up … · python/cpython@c40eeeb (original) (raw)
`@@ -1647,8 +1647,9 @@ class Helper:
`
1647
1647
` }
`
1648
1648
`# Either add symbols to this dictionary or to the symbols dictionary
`
1649
1649
`# directly: Whichever is easier. They are merged later.
`
``
1650
`+
_strprefixes = tuple(p + q for p in ('b', 'r', 'u') for q in ("'", '"'))
`
1650
1651
`_symbols_inverse = {
`
1651
``
`-
'STRINGS' : ("'", "'''", "r'", "u'", '"""', '"', 'r"', 'u"'),
`
``
1652
`+
'STRINGS' : ("'", "'''", '"""', '"') + _strprefixes,
`
1652
1653
`'OPERATORS' : ('+', '-', '*', '**', '/', '//', '%', '<<', '>>', '&',
`
1653
1654
`'|', '^', '~', '<', '>', '<=', '>=', '==', '!=', '<>'),
`
1654
1655
`'COMPARISON' : ('<', '>', '<=', '>=', '==', '!=', '<>'),
`
`@@ -1811,7 +1812,12 @@ def interact(self):
`
1811
1812
`if not request: break
`
1812
1813
`except (KeyboardInterrupt, EOFError):
`
1813
1814
`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]
`
1815
1821
`if lower(request) in ('q', 'quit'): break
`
1816
1822
`self.help(request)
`
1817
1823
``