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

This commit is contained in:
Xiang Zhang 2018-03-25 12:09:21 +08:00 committed by GitHub
parent c42e7aa67c
commit e4ce9fa89c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

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