[Python-checkins] bpo-32943: Fix confusing error message for rot13 codec (GH-5869)

Miss Islington (bot) webhook-mailer at python.org
Sun Mar 25 00:30:42 EDT 2018


https://github.com/python/cpython/commit/291d5f3e7195659f874fe56b0e3ed717b57597ee
commit: 291d5f3e7195659f874fe56b0e3ed717b57597ee
branch: 3.7
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2018-03-24T21:30:39-07:00
summary:

bpo-32943: Fix confusing error message for rot13 codec (GH-5869)

(cherry picked from commit e4ce9fa89cb542dced553710b05de85202bc4715)

Co-authored-by: Xiang Zhang <angwerzx at 126.com>

files:
M Lib/encodings/rot_13.py

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 @@
 
 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



More information about the Python-checkins mailing list