]> granicus.if.org Git - python/commitdiff
Patch #442512: put block indices in the right byte order on bigendian systems.
authorMartin v. Löwis <martin@v.loewis.de>
Thu, 19 Jul 2001 14:26:10 +0000 (14:26 +0000)
committerMartin v. Löwis <martin@v.loewis.de>
Thu, 19 Jul 2001 14:26:10 +0000 (14:26 +0000)
Lib/sre_compile.py

index 539e878dce15f0d08d0ccb6894325b74093a1b96..ba0a8712f8b9f60d6bc3e13bf78657d895638c47 100644 (file)
@@ -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)]