mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Fix an issue with str.translate() in IDLE -- str.translate() only accepts
a dict argument now.
This commit is contained in:
parent
f06628b072
commit
b0efee2669
1 changed files with 4 additions and 3 deletions
|
@ -94,15 +94,16 @@ _chew_ordinaryre = re.compile(r"""
|
|||
# Build translation table to map uninteresting chars to "x", open
|
||||
# brackets to "(", and close brackets to ")".
|
||||
|
||||
_tran = ['x'] * 256
|
||||
_tran = {}
|
||||
for i in range(256):
|
||||
_tran[i] = 'x'
|
||||
for ch in "({[":
|
||||
_tran[ord(ch)] = '('
|
||||
for ch in ")}]":
|
||||
_tran[ord(ch)] = ')'
|
||||
for ch in "\"'\\\n#":
|
||||
_tran[ord(ch)] = ch
|
||||
_tran = ''.join(_tran)
|
||||
del ch
|
||||
del i, ch
|
||||
|
||||
class Parser:
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue