Unverified Kaydet (Commit) 0ba812b1 authored tarafından Miss Islington (bot)'s avatar Miss Islington (bot) Kaydeden (comit) GitHub

bpo-33422: Fix quotation marks getting deleted when looking up byte/string…

bpo-33422: Fix quotation marks getting deleted when looking up byte/string literals on pydoc. (GH-6701)


Also update the list of string prefixes.
(cherry picked from commit b2043bbe)
Co-authored-by: 's avatarAndrés Delfino <adelfino@gmail.com>
üst eb5abdc7
......@@ -1716,8 +1716,9 @@ class Helper:
}
# Either add symbols to this dictionary or to the symbols dictionary
# directly: Whichever is easier. They are merged later.
_strprefixes = [p + q for p in ('b', 'f', 'r', 'u') for q in ("'", '"')]
_symbols_inverse = {
'STRINGS' : ("'", "'''", "r'", "b'", '"""', '"', 'r"', 'b"'),
'STRINGS' : ("'", "'''", '"', '"""', *_strprefixes),
'OPERATORS' : ('+', '-', '*', '**', '/', '//', '%', '<<', '>>', '&',
'|', '^', '~', '<', '>', '<=', '>=', '==', '!=', '<>'),
'COMPARISON' : ('<', '>', '<=', '>=', '==', '!=', '<>'),
......@@ -1874,7 +1875,13 @@ has the same effect as typing a particular string at the help> prompt.
if not request: break
except (KeyboardInterrupt, EOFError):
break
request = replace(request, '"', '', "'", '').strip()
request = request.strip()
# Make sure significant trailing quoting marks of literals don't
# get deleted while cleaning input
if (len(request) > 2 and request[0] == request[-1] in ("'", '"')
and request[0] not in request[1:-1]):
request = request[1:-1]
if request.lower() in ('q', 'quit'): break
if request == 'help':
self.intro()
......
Fix trailing quotation marks getting deleted when looking up byte/string
literals on pydoc. Patch by Andrés Delfino.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment