summaryrefslogtreecommitdiffstats
path: root/Lib/encodings
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2006-08-02 13:53:55 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2006-08-02 13:53:55 (GMT)
commit961b91bd3c48af639acbf20bbf15a85e7152ff6e (patch)
tree4431b108f80ee972a2796bee6272523d1560d200 /Lib/encodings
parent5c387f2e5d4f21f9e8104d4d5410fc1fd91fa7e9 (diff)
downloadcpython-961b91bd3c48af639acbf20bbf15a85e7152ff6e.zip
cpython-961b91bd3c48af639acbf20bbf15a85e7152ff6e.tar.gz
cpython-961b91bd3c48af639acbf20bbf15a85e7152ff6e.tar.bz2
Correction of patch #1455898: In the mbcs decoder, set final=False
for stream decoder, but final=True for the decode function.
Diffstat (limited to 'Lib/encodings')
-rw-r--r--Lib/encodings/mbcs.py30
1 files changed, 11 insertions, 19 deletions
diff --git a/Lib/encodings/mbcs.py b/Lib/encodings/mbcs.py
index ccf08e3..baf46cb 100644
--- a/Lib/encodings/mbcs.py
+++ b/Lib/encodings/mbcs.py
@@ -15,39 +15,31 @@ import codecs
### Codec APIs
-class Codec(codecs.Codec):
+encode = mbcs_encode
- # Note: Binding these as C functions will result in the class not
- # converting them to methods. This is intended.
- encode = mbcs_encode
- decode = mbcs_decode
+def decode(input, errors='strict'):
+ return mbcs_decode(input, errors, True)
class IncrementalEncoder(codecs.IncrementalEncoder):
def encode(self, input, final=False):
- return mbcs_encode(input,self.errors)[0]
+ return mbcs_encode(input, self.errors)[0]
class IncrementalDecoder(codecs.BufferedIncrementalDecoder):
- def _buffer_decode(self, input, errors, final):
- return mbcs_decode(input,self.errors,final)
-
-class StreamWriter(Codec,codecs.StreamWriter):
- pass
+ _buffer_decode = mbcs_decode
-class StreamReader(Codec,codecs.StreamReader):
- pass
-
-class StreamConverter(StreamWriter,StreamReader):
+class StreamWriter(codecs.StreamWriter):
+ encode = mbcs_encode
- encode = codecs.mbcs_decode
- decode = codecs.mbcs_encode
+class StreamReader(codecs.StreamReader):
+ decode = mbcs_decode
### encodings module API
def getregentry():
return codecs.CodecInfo(
name='mbcs',
- encode=Codec.encode,
- decode=Codec.decode,
+ encode=encode,
+ decode=decode,
incrementalencoder=IncrementalEncoder,
incrementaldecoder=IncrementalDecoder,
streamreader=StreamReader,