From: Xiang Zhang Date: Sun, 25 Mar 2018 04:09:21 +0000 (+0800) Subject: bpo-32943: Fix confusing error message for rot13 codec (GH-5869) X-Git-Tag: v3.8.0a1~2046 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e4ce9fa89cb542dced553710b05de85202bc4715;p=thirdparty%2FPython%2Fcpython.git bpo-32943: Fix confusing error message for rot13 codec (GH-5869) --- diff --git a/Lib/encodings/rot_13.py b/Lib/encodings/rot_13.py index f0b4186dc877..5627bfbc69cb 100755 --- a/Lib/encodings/rot_13.py +++ b/Lib/encodings/rot_13.py @@ -12,18 +12,18 @@ import codecs class Codec(codecs.Codec): def encode(self, input, errors='strict'): - return (input.translate(rot13_map), len(input)) + return (str.translate(input, rot13_map), len(input)) def decode(self, input, errors='strict'): - return (input.translate(rot13_map), len(input)) + return (str.translate(input, rot13_map), len(input)) class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input, final=False): - return input.translate(rot13_map) + return str.translate(input, rot13_map) class IncrementalDecoder(codecs.IncrementalDecoder): def decode(self, input, final=False): - return input.translate(rot13_map) + return str.translate(input, rot13_map) class StreamWriter(Codec,codecs.StreamWriter): pass