summaryrefslogtreecommitdiffstats
path: root/Lib/encodings/utf_7.py
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2007-11-20 23:38:09 (GMT)
committerChristian Heimes <christian@cheimes.de>2007-11-20 23:38:09 (GMT)
commit5d14c2b8f87b23a9257c97b5f98dd097ca289c78 (patch)
treee7f70d363ad656494d995fce4e74e95ba70ca688 /Lib/encodings/utf_7.py
parent81e8ab5ba074694750072fb50081b77da16180a0 (diff)
downloadcpython-5d14c2b8f87b23a9257c97b5f98dd097ca289c78.zip
cpython-5d14c2b8f87b23a9257c97b5f98dd097ca289c78.tar.gz
cpython-5d14c2b8f87b23a9257c97b5f98dd097ca289c78.tar.bz2
Merged revisions 59056-59076 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r59064 | christian.heimes | 2007-11-20 02:48:48 +0100 (Tue, 20 Nov 2007) | 1 line Fixed bug #1470 ........ r59066 | martin.v.loewis | 2007-11-20 03:46:02 +0100 (Tue, 20 Nov 2007) | 2 lines Patch #1468: Package Lib/test/*.pem. ........ r59068 | christian.heimes | 2007-11-20 04:21:02 +0100 (Tue, 20 Nov 2007) | 1 line Another fix for test_shutil. Martin pointed out that it breaks some build bots ........ r59073 | nick.coghlan | 2007-11-20 15:55:57 +0100 (Tue, 20 Nov 2007) | 1 line Backport some main.c cleanup from the py3k branch ........ r59076 | amaury.forgeotdarc | 2007-11-21 00:31:27 +0100 (Wed, 21 Nov 2007) | 6 lines The incremental decoder for utf-7 must preserve its state between calls. Solves issue1460. Might not be a backport candidate: a new API function was added, and some code may rely on details in utf-7.py. ........
Diffstat (limited to 'Lib/encodings/utf_7.py')
-rw-r--r--Lib/encodings/utf_7.py23
1 files changed, 10 insertions, 13 deletions
diff --git a/Lib/encodings/utf_7.py b/Lib/encodings/utf_7.py
index d78d192..8e0567f 100644
--- a/Lib/encodings/utf_7.py
+++ b/Lib/encodings/utf_7.py
@@ -6,34 +6,31 @@ import codecs
### Codec APIs
-class Codec(codecs.Codec):
+encode = codecs.utf_7_encode
- # Note: Binding these as C functions will result in the class not
- # converting them to methods. This is intended.
- encode = codecs.utf_7_encode
- decode = codecs.utf_7_decode
+def decode(input, errors='strict'):
+ return codecs.utf_7_decode(input, errors, True)
class IncrementalEncoder(codecs.IncrementalEncoder):
def encode(self, input, final=False):
return codecs.utf_7_encode(input, self.errors)[0]
class IncrementalDecoder(codecs.BufferedIncrementalDecoder):
- def _buffer_decode(self, input, errors, final):
- return codecs.utf_7_decode(input, self.errors)
+ _buffer_decode = codecs.utf_7_decode
-class StreamWriter(Codec,codecs.StreamWriter):
- pass
+class StreamWriter(codecs.StreamWriter):
+ encode = codecs.utf_7_encode
-class StreamReader(Codec,codecs.StreamReader):
- pass
+class StreamReader(codecs.StreamReader):
+ decode = codecs.utf_7_decode
### encodings module API
def getregentry():
return codecs.CodecInfo(
name='utf-7',
- encode=Codec.encode,
- decode=Codec.decode,
+ encode=encode,
+ decode=decode,
incrementalencoder=IncrementalEncoder,
incrementaldecoder=IncrementalDecoder,
streamreader=StreamReader,