mirror of
				https://github.com/python/cpython.git
				synced 2025-10-24 18:33:49 +00:00 
			
		
		
		
	 49fd7fa443
			
		
	
	
		49fd7fa443
		
	
	
	
	
		
			
			number of tests, all because of the codecs/_multibytecodecs issue described here (it's not a Py3K issue, just something Py3K discovers): http://mail.python.org/pipermail/python-dev/2006-April/064051.html Hye-Shik Chang promised to look for a fix, so no need to fix it here. The tests that are expected to break are: test_codecencodings_cn test_codecencodings_hk test_codecencodings_jp test_codecencodings_kr test_codecencodings_tw test_codecs test_multibytecodec This merge fixes an actual test failure (test_weakref) in this branch, though, so I believe merging is the right thing to do anyway.
		
			
				
	
	
		
			39 lines
		
	
	
	
		
			1 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			39 lines
		
	
	
	
		
			1 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
| #
 | |
| # iso2022_jp_3.py: Python Unicode Codec for ISO2022_JP_3
 | |
| #
 | |
| # Written by Hye-Shik Chang <perky@FreeBSD.org>
 | |
| #
 | |
| 
 | |
| import _codecs_iso2022, codecs
 | |
| import _multibytecodec as mbc
 | |
| 
 | |
| codec = _codecs_iso2022.getcodec('iso2022_jp_3')
 | |
| 
 | |
| class Codec(codecs.Codec):
 | |
|     encode = codec.encode
 | |
|     decode = codec.decode
 | |
| 
 | |
| class IncrementalEncoder(mbc.MultibyteIncrementalEncoder,
 | |
|                          codecs.IncrementalEncoder):
 | |
|     codec = codec
 | |
| 
 | |
| class IncrementalDecoder(mbc.MultibyteIncrementalDecoder,
 | |
|                          codecs.IncrementalDecoder):
 | |
|     codec = codec
 | |
| 
 | |
| class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):
 | |
|     codec = codec
 | |
| 
 | |
| class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter):
 | |
|     codec = codec
 | |
| 
 | |
| def getregentry():
 | |
|     return codecs.CodecInfo(
 | |
|         name='iso2022_jp_3',
 | |
|         encode=Codec().encode,
 | |
|         decode=Codec().decode,
 | |
|         incrementalencoder=IncrementalEncoder,
 | |
|         incrementaldecoder=IncrementalDecoder,
 | |
|         streamreader=StreamReader,
 | |
|         streamwriter=StreamWriter,
 | |
|     )
 |