| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent b69bb3d commit b28de0d
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -7,7 +7,7 @@ | |||
| 7 | 7 | ||
| 8 | 8 | """#" | |
| 9 | 9 | ||
| 10 | - import struct, __builtin__ | ||
| 10 | + import __builtin__, sys | ||
| 11 | 11 | ||
| 12 | 12 | ### Registry and builtin stateless codec functions | |
| 13 | 13 | ||
@@ -48,11 +48,21 @@ | |||
| 48 | 48 | # UTF-32, big endian | |
| 49 | 49 | BOM_UTF32_BE = '\x00\x00\xfe\xff' | |
| 50 | 50 | ||
| 51 | - # UTF-16, native endianness | ||
| 52 | - BOM = BOM_UTF16 = struct.pack('=H', 0xFEFF) | ||
| 51 | + if sys.byteorder == 'little': | ||
| 53 | 52 | ||
| 54 | - # UTF-32, native endianness | ||
| 55 | - BOM_UTF32 = struct.pack('=L', 0x0000FEFF) | ||
| 53 | + # UTF-16, native endianness | ||
| 54 | + BOM = BOM_UTF16 = BOM_UTF16_LE | ||
| 55 | + | ||
| 56 | + # UTF-32, native endianness | ||
| 57 | + BOM_UTF32 = BOM_UTF32_LE | ||
| 58 | + | ||
| 59 | + else: | ||
| 60 | + | ||
| 61 | + # UTF-16, native endianness | ||
| 62 | + BOM = BOM_UTF16 = BOM_UTF16_BE | ||
| 63 | + | ||
| 64 | + # UTF-32, native endianness | ||
| 65 | + BOM_UTF32 = BOM_UTF32_BE | ||
| 56 | 66 | ||
| 57 | 67 | # Old broken names (don't use in new code) | |
| 58 | 68 | BOM32_LE = BOM_UTF16_LE | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -10,4 +10,4 @@ | |||
| 10 | 10 | @USE_SIGNAL_MODULE@signal signalmodule.c | |
| 11 | 11 | ||
| 12 | 12 | # The rest of the modules previously listed in this file are built | |
| 13 | - # by the setup.py script in Python 2.1. | ||
| 13 | + # by the setup.py script in Python 2.1 and later. | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -111,6 +111,7 @@ PYTHONPATH=$(COREPYTHONPATH) | |||
| 111 | 111 | posix posixmodule.c # posix (UNIX) system calls | |
| 112 | 112 | errno errnomodule.c # posix (UNIX) errno values | |
| 113 | 113 | _sre _sre.c # Fredrik Lundh's new regular expressions | |
| 114 | + _codecs _codecsmodule.c # access to the builtin codecs and codec registry | ||
| 114 | 115 | ||
| 115 | 116 | # The rest of the modules listed in this file are all commented out by | |
| 116 | 117 | # default. Usually they can be detected and built as dynamically | |
@@ -163,7 +164,6 @@ GLHACK=-Dclear=__GLclear | |||
| 163 | 164 | #time timemodule.c # -lm # time operations and variables | |
| 164 | 165 | #operator operator.c # operator.add() and similar goodies | |
| 165 | 166 | #_weakref _weakref.c # basic weak reference support | |
| 166 | - #_codecs _codecsmodule.c # access to the builtin codecs and codec registry | ||
| 167 | 167 | #_testcapi _testcapimodule.c # Python C API test module | |
| 168 | 168 | ||
| 169 | 169 | #unicodedata unicodedata.c # static Unicode character database | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -313,8 +313,6 @@ def detect_modules(self): | |||
| 313 | 313 | libraries=math_libs) ) | |
| 314 | 314 | # operator.add() and similar goodies | |
| 315 | 315 | exts.append( Extension('operator', ['operator.c']) ) | |
| 316 | - # access to the builtin codecs and codec registry | ||
| 317 | - exts.append( Extension('_codecs', ['_codecsmodule.c']) ) | ||
| 318 | 316 | # Python C API test module | |
| 319 | 317 | exts.append( Extension('_testcapi', ['_testcapimodule.c']) ) | |
| 320 | 318 | # static Unicode character database | |
| Back | FazBrowse Home | New Git URL |
0 commit comments