Patch #1436130: codecs.lookup() now returns a CodecInfo object (a subclass
of tuple) that provides incremental decoders and encoders (a way to use
stateful codecs without the stream API). Functions
codecs.getincrementaldecoder() and codecs.getincrementalencoder() have
been added.
diff --git a/Lib/encodings/koi8_u.py b/Lib/encodings/koi8_u.py
index 9bbcf7c..4709d9c 100644
--- a/Lib/encodings/koi8_u.py
+++ b/Lib/encodings/koi8_u.py
@@ -1,4 +1,4 @@
-""" Python Character Mapping Codec generated from 'python-mappings/KOI8-U.TXT' with gencodec.py.
+""" Python Character Mapping Codec koi8_u generated from 'python-mappings/KOI8-U.TXT' with gencodec.py.
 
 """#"
 
@@ -9,13 +9,19 @@
 class Codec(codecs.Codec):
 
     def encode(self,input,errors='strict'):
-
         return codecs.charmap_encode(input,errors,encoding_map)
 
     def decode(self,input,errors='strict'):
-
         return codecs.charmap_decode(input,errors,decoding_table)
 
+class IncrementalEncoder(codecs.IncrementalEncoder):
+    def encode(self, input, final=False):
+        return codecs.charmap_encode(input,self.errors,encoding_map)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+    def decode(self, input, final=False):
+        return codecs.charmap_decode(input,self.errors,decoding_table)[0]
+
 class StreamWriter(Codec,codecs.StreamWriter):
     pass
 
@@ -25,8 +31,15 @@
 ### encodings module API
 
 def getregentry():
-
-    return (Codec().encode,Codec().decode,StreamReader,StreamWriter)
+    return codecs.CodecInfo(
+        name='koi8-u',
+        encode=Codec().encode,
+        decode=Codec().decode,
+        incrementalencoder=IncrementalEncoder,
+        incrementaldecoder=IncrementalDecoder,
+        streamreader=StreamReader,
+        streamwriter=StreamWriter,
+    )
 
 
 ### Decoding Table
@@ -550,3 +563,4 @@
     0x2593: 0x92,       #  DARK SHADE
     0x25A0: 0x94,       #  BLACK SQUARE
 }
+