[Python-checkins] python/dist/src/Lib codecs.py,1.29,1.30

lemburg@users.sourceforge.net lemburg@users.sourceforge.net
2002年12月12日 09:37:53 -0800


Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1:/tmp/cvs-serv24009/Lib
Modified Files:
	codecs.py 
Log Message:
Patch to make _codecs a builtin module. This is necessary since
Python 2.3 will support source code encodings which rely on the
builtin codecs being available to the parser.
Remove struct dependency from codecs.py
Index: codecs.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/codecs.py,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -d -r1.29 -r1.30
*** codecs.py	19 Nov 2002 21:42:53 -0000	1.29
--- codecs.py	12 Dec 2002 17:37:49 -0000	1.30
***************
*** 8,12 ****
 """#"
 
! import struct, __builtin__
 
 ### Registry and builtin stateless codec functions
--- 8,12 ----
 """#"
 
! import __builtin__, sys
 
 ### Registry and builtin stateless codec functions
***************
*** 49,57 ****
 BOM_UTF32_BE = '\x00\x00\xfe\xff'
 
! # UTF-16, native endianness
! BOM = BOM_UTF16 = struct.pack('=H', 0xFEFF)
 
! # UTF-32, native endianness
! BOM_UTF32 = struct.pack('=L', 0x0000FEFF)
 
 # Old broken names (don't use in new code)
--- 49,67 ----
 BOM_UTF32_BE = '\x00\x00\xfe\xff'
 
! if sys.byteorder == 'little':
 
! # UTF-16, native endianness
! BOM = BOM_UTF16 = BOM_UTF16_LE
! 
! # UTF-32, native endianness
! BOM_UTF32 = BOM_UTF32_LE
! 
! else:
! 
! # UTF-16, native endianness
! BOM = BOM_UTF16 = BOM_UTF16_BE
! 
! # UTF-32, native endianness
! BOM_UTF32 = BOM_UTF32_BE
 
 # Old broken names (don't use in new code)

AltStyle によって変換されたページ (->オリジナル) /