bpo-32943: Fix confusing error message for rot13 codec (GH-5869)
This commit is contained in:
parent
c42e7aa67c
commit
e4ce9fa89c
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue