Unverified Kaydet (Commit) 291d5f3e authored tarafından Miss Islington (bot)'s avatar Miss Islington (bot) Kaydeden (comit) GitHub

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

(cherry picked from commit e4ce9fa8)
Co-authored-by: 's avatarXiang Zhang <angwerzx@126.com>
üst 5729b9c0
...@@ -12,18 +12,18 @@ import codecs ...@@ -12,18 +12,18 @@ import codecs
class Codec(codecs.Codec): class Codec(codecs.Codec):
def encode(self, input, errors='strict'): 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'): 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): class IncrementalEncoder(codecs.IncrementalEncoder):
def encode(self, input, final=False): def encode(self, input, final=False):
return input.translate(rot13_map) return str.translate(input, rot13_map)
class IncrementalDecoder(codecs.IncrementalDecoder): class IncrementalDecoder(codecs.IncrementalDecoder):
def decode(self, input, final=False): def decode(self, input, final=False):
return input.translate(rot13_map) return str.translate(input, rot13_map)
class StreamWriter(Codec,codecs.StreamWriter): class StreamWriter(Codec,codecs.StreamWriter):
pass pass
......
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