Commit 91355db6 authored by Guido van Rossum's avatar Guido van Rossum

Fix an issue with str.translate() in IDLE -- str.translate() only accepts

a dict argument now.
parent 509d7370
...@@ -94,15 +94,16 @@ _chew_ordinaryre = re.compile(r""" ...@@ -94,15 +94,16 @@ _chew_ordinaryre = re.compile(r"""
# Build translation table to map uninteresting chars to "x", open # Build translation table to map uninteresting chars to "x", open
# brackets to "(", and close brackets to ")". # brackets to "(", and close brackets to ")".
_tran = ['x'] * 256 _tran = {}
for i in range(256):
_tran[i] = 'x'
for ch in "({[": for ch in "({[":
_tran[ord(ch)] = '(' _tran[ord(ch)] = '('
for ch in ")}]": for ch in ")}]":
_tran[ord(ch)] = ')' _tran[ord(ch)] = ')'
for ch in "\"'\\\n#": for ch in "\"'\\\n#":
_tran[ord(ch)] = ch _tran[ord(ch)] = ch
_tran = ''.join(_tran) del i, ch
del ch
class Parser: class Parser:
......
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