diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2001-07-19 14:26:10 +0000 |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2001-07-19 14:26:10 +0000 |
commit | c5991fde847ec601fcbcd9fe7984cd88f142dc92 (patch) | |
tree | aec11f14c457527d9e8b42b0817bb560a70bd42d /Lib/sre_compile.py | |
parent | 88ba2c0f4f534b5b01e18d4262e611fac3dca34c (diff) | |
download | cpython-c5991fde847ec601fcbcd9fe7984cd88f142dc92.tar.gz |
Patch #442512: put block indices in the right byte order on bigendian systems.
Diffstat (limited to 'Lib/sre_compile.py')
-rw-r--r-- | Lib/sre_compile.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Lib/sre_compile.py b/Lib/sre_compile.py index 539e878dce..ba0a8712f8 100644 --- a/Lib/sre_compile.py +++ b/Lib/sre_compile.py @@ -8,7 +8,7 @@ # See the sre.py file for information on usage and redistribution. # -import _sre +import _sre,sys from sre_constants import * @@ -281,7 +281,10 @@ def _optimize_unicode(charset, fixup): header = [block] assert MAXCODE == 65535 for i in range(128): - header.append(mapping[2*i]+256*mapping[2*i+1]) + if sys.byteorder == 'big': + header.append(256*mapping[2*i]+mapping[2*i+1]) + else: + header.append(mapping[2*i]+256*mapping[2*i+1]) data[0:0] = header return [(BIGCHARSET, data)] |