summaryrefslogtreecommitdiffstats
path: root/Lib/encodings/unicode_escape.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/encodings/unicode_escape.py')
-rw-r--r--Lib/encodings/unicode_escape.py19
1 files changed, 17 insertions, 2 deletions
diff --git a/Lib/encodings/unicode_escape.py b/Lib/encodings/unicode_escape.py
index 8fb6293..817f932 100644
--- a/Lib/encodings/unicode_escape.py
+++ b/Lib/encodings/unicode_escape.py
@@ -17,6 +17,14 @@ class Codec(codecs.Codec):
encode = codecs.unicode_escape_encode
decode = codecs.unicode_escape_decode
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.unicode_escape_encode(input, self.errors)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.unicode_escape_decode(input, self.errors)[0]
+
class StreamWriter(Codec,codecs.StreamWriter):
pass
@@ -26,5 +34,12 @@ class StreamReader(Codec,codecs.StreamReader):
### encodings module API
def getregentry():
-
- return (Codec.encode,Codec.decode,StreamReader,StreamWriter)
+ return codecs.CodecInfo(
+ name='unicode-escape',
+ encode=Codec.encode,
+ decode=Codec.decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamwriter=StreamWriter,
+ streamreader=StreamReader,
+ )