diff options
author | Guido van Rossum <guido@python.org> | 2007-11-21 20:07:54 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2007-11-21 20:07:54 (GMT) |
commit | b0efee26693127d9378826667b480dc8e7cc4f2a (patch) | |
tree | 85be8e30dbf8512e09808ae8d02375faf426a189 /Lib/idlelib | |
parent | f06628b072cc0f447939af5aaf4aa58f1489a0e3 (diff) | |
download | cpython-b0efee26693127d9378826667b480dc8e7cc4f2a.zip cpython-b0efee26693127d9378826667b480dc8e7cc4f2a.tar.gz cpython-b0efee26693127d9378826667b480dc8e7cc4f2a.tar.bz2 |
Fix an issue with str.translate() in IDLE -- str.translate() only accepts
a dict argument now.
Diffstat (limited to 'Lib/idlelib')
-rw-r--r-- | Lib/idlelib/PyParse.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Lib/idlelib/PyParse.py b/Lib/idlelib/PyParse.py index d200b6c..61a0003 100644 --- a/Lib/idlelib/PyParse.py +++ b/Lib/idlelib/PyParse.py @@ -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: |