summaryrefslogtreecommitdiffstats
path: root/Lib/encodings/unicode_internal.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/encodings/unicode_internal.py')
-rw-r--r--Lib/encodings/unicode_internal.py19
1 files changed, 17 insertions, 2 deletions
diff --git a/Lib/encodings/unicode_internal.py b/Lib/encodings/unicode_internal.py
index 3bd2fa0..df3e775 100644
--- a/Lib/encodings/unicode_internal.py
+++ b/Lib/encodings/unicode_internal.py
@@ -17,6 +17,14 @@ class Codec(codecs.Codec):
encode = codecs.unicode_internal_encode
decode = codecs.unicode_internal_decode
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.unicode_internal_encode(input, self.errors)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.unicode_internal_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-internal',
+ encode=Codec.encode,
+ decode=Codec.decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamwriter=StreamWriter,
+ streamreader=StreamReader,
+ )